Best way to implement a word frequency counter (input => textfile)?

1182 byte By lapcherna at 2007-10-3 1:28:32
i had this for an interview question and basically came up with the solution where you use a hash table...//create hash table//bufferedreader//read file in,//for each word encountered, create an object that has (String word, int count) and push into hash table//then loop and read out all the ...

Buffering using Array and reading parts of it.

543 byte By mihailmileva at 2007-10-3 1:37:36
Hi,Excuse me, but I wasn't able to form the subject of the title very good. Now I will explain you the problem better: I have a file splitted in many parts (for example 100). In order to join this file I have to read all the parts, one by one, and update an array, to which every part is added. ...

Get the Length of a mp3 file

325 byte By mihailmileva at 2007-10-3 1:39:47
OK, me again. Could someone help me with an algorithm to get the length (in seconds) of a mp3 file, or an already created library. I know an algorithm like this one:(song_bytes*8)/(bit_rate)*1024 . The problem is, that it only works if it's encoded with LAME, and with other shows different ...

Efficient data structure to implement simple text editor?

2414 byte By lapcherna at 2007-10-3 1:50:22
I was given this problem in an interview:What data structure would you use to implement a simple text editor that does these 4 functions:a) goto(line number)b) insert(char input,location)c) delete(location)d) printAll() //print entire fileGiven that i'm such a newb, i was stumped. I came up ...

Removing Cycles from Graphs

321 byte By sergio06a at 2007-10-3 1:55:15
Hello,is anyone familiar with the problem of removing cycles from a directed graph G? I would like to form a DAG G' where all possible paths that are present in G are still present in G', except that these paths don't have to be infinite (the cycles can be traversed only ...

How to write it in Java?

399 byte By patucosa at 2007-10-3 1:58:24
Hi everyone in the forum,i gotta translate this matehmatical expressions into java but no idea how. Any suggestion? :freq_um[getPositionFromString(value)] = 1.0D4/(FREQ(I)/1.0D6/29979.2458);freq_mixt[getPositionFromString(value)] = 1.0D4/(FREQ(I)/1.0D6/29979.2458);I mean the arithmetic ...

Dialog resize in SWT

1333 byte By Sarayu_Geethajalia at 2007-10-3 1:59:38
Hi,I have a composite in a dialog.I want to resize the dialog and when the dialog is resizing i want to update the composite accordigly.I am using SWT.RESIZE | SWT.MAX for the dialog which is ok.How do I set the resizing of the composite also?To resize the ...

Rsync

106 byte By Jignesh_Togadiyaa at 2007-10-3 2:02:04
Hi,I Devloping Rsync algo for java ,it work fine for text document but it fail for .doc file

Pipeline algorithm Problem (Threads?)

671 byte By onioa at 2007-10-3 2:06:36
I need an algorithm that will simulate a processor executing instructions.Each instruction is divided into 5 execution parts or stages (IF, ID, EX, MEM, WB)Each of these parts or stages should be executed for each clock cycle.And for each clock cycle, a new instruction (with the same 5 stages) ...

arbitrary dimension array for math

792 byte By dimitria at 2007-10-3 2:16:53
Hi,I need some help writing a class implementing operations on arbitrarydimension array, and be able to apply operation like block extraction,vector or matrix product , filter (product for a matrix of smallerdimension, kind of mask)for arbitrary dimension i mean a class wich at run time can be ...

decryption

110 byte By mikirulea at 2007-10-3 2:19:15
i want to write a program that will decrypt ciphertext given in hexadecimal ASCII-based. How do I start

HEX (UNICODE) to ANSII

451 byte By bozia at 2007-10-3 2:21:43
Hi,I have a simple application that takes in a subject and sends an email with that subject. The problem is that I need the subject to be in Korean, so what happens is: 林咯矾盒膊 is entered but the email is received with 주여러분께 in the subject line instead. I have ...

preprocessing for string matching algorithm

928 byte By av86a at 2007-10-3 2:21:46
hi i have a problem in which i have to match an array of strings with a given text(which might be very large). i have used both knuth morris pratt and boyor moore algorithm and am happy with the outcome.but before checking the string i am supposed to do some preprocessing likeif i am given 2 ...

Dissolve image transition effect

453 byte By haitrieu.phunga at 2007-10-3 2:27:21
I'm doing an application that requires displaying images in the background (each one is displayed for 15 second).The problem I'm facing is that when switching from one image to another, it must have the dissolve transition effect (dissolve the current image and in the same time display the ...

xml,dataBase or txt file is faster?

533 byte By decodaa at 2007-10-3 2:36:31
hii wanted to ask which is faster to read data fromif i wanted to save a strings in the form of"12334 3334 12345"12334 3334 12345"12334 3334 12345""and then to be read by java application which will parser itand place the values to an (int size=12334, int pos_x=3334, int pos_y12345)will an xml ...

finding closest image colors

197 byte By @@aa@@--@-@aa@@a at 2007-10-3 2:38:28
I am making a program that loads an image and saves a version that only uses the colors in a pallet. What is the best algorithm to use to match the pixels to the nearest color in the pallet?

Complex Counting

1366 byte By disruptivea at 2007-10-3 2:40:01
I have a math/algorithmic challenge.I have a simulation where I have a number of point objects grouped on the surface of a sphere. Now I have a number of these spheres programmticaly determined and each with a different number of points that comprise each sphere.What I wish to do is count the ...

Database Searching Algorithms

315 byte By Kuntilanaka at 2007-10-3 2:53:55
Hi..I have to do some research about database searching algorithms.Would someone here help me and give a list of that algorithms and which one is the best.What is the name of this algorithms which when u type in a key such "a" then it display a list of information that started with ...

Problems with sorting of Timestamps and integers

726 byte By Darulla at 2007-10-3 2:57:43
Hi. I am having some problems when I抦 trying to sort a list of Timestamps and integers.. the thing is that i have a list of Objects(Tasks) containing Timestamps(StartTime and EndTime) and an integer, Priority (0 or 1), the different Tasks are to be sorted after StartTime, EndTime and priority, ...

Problem in editing drawn shape...

714 byte By cattie79a at 2007-10-3 3:08:24
Hi. I have to complete my project. The work is to create drawing tools graphical editor. I'm new to java and I have some problems with this job, so I'm looking for help where it is possible...I created basic shape and fiiled shape.the problem is i dont know how to edit all these shape such as ...

Formatting string using StringTokenizer

1263 byte By Dhaval-Shaha at 2007-10-3 3:10:41
I have a string retrieved from a database such as[[TO_CHAR(MIN(WEEK),'DD-MON-YYYY')], [30-OCT-2005]]For some reason it prepends my sql query to the string so I'm using a StringTokenizer to remove all the useless stuff and retrieve the dateSo far I have:private void formatDate(String ...

Finding Cycles in a Graph

247 byte By rexlanda at 2007-10-3 3:35:49
Can anybody help me with an algorithm to detect cycles within a graph? or at least give me some direction on how to write a program to find all cycles in a graph. I have been stuggling to find something in vain. Thanks,Rexland

Algorithm for Plotting Objects on Ellipse

2780 byte By nbloma at 2007-10-3 3:54:37
Hello All,I am sure something like this has been posted before, but I could not find it via search.I am wondering how I can go about plotting nodes or objects on an ellipse. I have code for a circle. The circle algorithm takes into account the number of nodes in the list and calculates the ...

Text parsing into Runtime Commands !

949 byte By Tarek_ELdeeba at 2007-10-3 4:03:54
Hello All ..I want to make a mini Matlab for mobile phones .. or you could name it a smart calculator .. The base of such a project is the String command parsing ..Assume the user is allowed to type:x = 5By text tokenizing by "=" .. I can get the variable name and value ..if the variable name ...

dimension reduction

126 byte By javvvaa at 2007-10-3 4:05:45
Hi, can anyone recommend simple function or algorithm to reduce datasets with N>3 number of dimensions to 3? Thanks.

Random Password Generation with 16 Numeric Digits

698 byte By TimirKumarPatela at 2007-10-3 4:17:31
Hi All,Folowing are my requirements 1. Generate 16 Digits long Randomize Numeric Passwords,Please not that, I need to generate password in bulk i.e. Generate 1000 to 10000 pasword in single trigger2. Store All Generated Password in DatabaseMy Problem:1. First of All How to Generate Random ...

Algorithm of finding out similar products

601 byte By asklxfa at 2007-10-3 4:18:18
hi, i have a problem of how to find out similar products in a web store.There is 3 tables in database: Product, Property and Product_Property for many-on-many relationship, each product can have one or more properties. for example:Product A has: p1, p2, p5, p6, p9B has: p2, p5, p6, p7, p9, p10C ...

time table algorithm

115 byte By jaya_ra at 2007-10-3 4:28:09
I need to do a project for time table generation. I need the algorithm for doing the same. Kindly send it...

Kakuro

221 byte By Lawler1079a at 2007-10-3 4:29:08
I'm trying to develop a simple Kakuro game and I'm having a hard time trying to come up with the algorithm. Does anybody have some good input on the algorithm and more importantly, the recommended data structure?

reduce time cost, need help

1103 byte By principlesa at 2007-10-3 4:33:06
I have a following problem:I receive M N-array of integers. Then for each array, I'll read the entire array element by element. For each element's value, an appropriate function will be called. More detail:n1 -> call function f1();n2 -> call function f2();.....nN -> call function ...

Need some help regarding arraylist

635 byte By Sarayu_Geethajalia at 2007-10-3 4:35:52
Hi,ArrayList arrL = new ArrayList(); ArrayList tmpArrL = new ArrayList();for (int i = 0; i < size; i++) {Character ch = new Character(text.charAt(i));arrL.add(ch);}tmpArrL = arrL;;; String newText = "";for (int i = 0; i < arrL.size(); i++) {newText += tmpArrL.get(i); }return newText;In ...

Regarding flat files: txt Vs xml files, which is faster for performance?

823 byte By angeshwara at 2007-10-3 4:41:39
Regarding flat files txt Vs xml filesHello all,In our projects we are extracting SMS messages and based on the MISDN (Telephone number) of each SMS we are fetching the correspondingaccount information (server name and password) from the database through (connecting through) webservice.This ...

Algorithm or pseudo code sought for getting the latest last modified time..

510 byte By ravishakyaa at 2007-10-3 4:58:29
Hi I need to write a program in java that lists the latest last modified time among the files in folders and its subfolder and also gets the size of the folder. In my case, average folder size is 9 GB. Could you please suggest any algorithm to achieve this? I tried to implement it by gathering ...

Formatting a float

551 byte By patucosa at 2007-10-3 4:58:54
Hi everyone in the forum,first of all i am not sure if this question should be here, but i did not found any other forum, so apolodize if it should not be here.So the problem i have is that i am working with float and i am displaying them in several textfields converting them into Strings. The ...

compute weights to minimize sum of squares with constraint

286 byte By rkippena at 2007-10-3 5:05:43
How to compute weights such that:SIGMA [(xi)^2 * (wi)^2]is minimized with the constraintSIGMA[(wi)] = 1I have values for all xi, and need to compute weights wi. Or suggestions for matheticmal packages that can solve this type of problem.Thanks.

Time table generator algorithm

280 byte By ttgaa at 2007-10-3 5:11:41
hi friends my name is Naveen. i am working on final year project of time table generator and i need a help. i want a coding of time table generator in java language so pls if any one have coding in java of time table pls kindly give me on my email id sa.silicon@yahoo.co.in

How to know a double has significant decimal part or not

582 byte By David_Leala at 2007-10-3 5:23:57
Dear members,I would like to know if a number stored on a double value is really a double or just an integer value.long iSum = Math.round(sum); // sum is double typedouble diff = sum - iSum;assert diff == 0.0: "The ammount should not be a decimal value";This is valid under floating ploint ...

Deadlock Free Minimum Hop Routing Table

1678 byte By proshnoUTa at 2007-10-3 5:41:33
I'm a student at UT Austin and currently facing critical problem in solving a problem called "Finding Deadlock Free Minimum Hop Routing Table Generation".In this problem a network topology will be given (as an adjacency list), and the output will be a routing table (adjacency matrix), such ...

Dual graph algorithm

1051 byte By M.M.a at 2007-10-3 5:41:44
Hello to all of you! Does anyone know a known algorithm to create the dual graph of a planar (undirected) graph? Or could you give me a hint? I tried to devise a DFS approach, which would use the back and cross edges of the DFS tree in order to form the faces. The problem is that I need the set ...

Distribution Counting Sort

850 byte By JuppieJuxa at 2007-10-3 5:42:53
Hi all,I've been given an algorithm and am supposed to code it using Java. The thing is I'm not quite sure how to go about implementing the algorithm itself and would really appreciate it if somebody could extend their help.ALGORITHM DistributionCounting(A[0...n-1],L,u)//Sorts an array of ...

Substring Algorithm

781 byte By C_Zhaoa at 2007-10-3 5:42:59
Hi, I have been given a practice problem involving dynamic programming and i would appreciate some helpIf you are given 2 strings, str1 and str2, find the longest possible common substring.So, for example, if given the strings 'rebublican' and 'democrat' (sans quotes), the longest common ...

parse message algorithms..

7114 byte By kyhoa at 2007-10-3 5:45:10
hi all,we are involving in sms project. due to the limitation of sms..we need parse a exceed length message into smaller one.we have implement a method to split the message to an array of vector.but i got the the method seem very burte force. here is the example code. I am seeking a better ...

Rush hour game algorithm

788 byte By cnaanta at 2007-10-3 5:51:31
I was playing a game called rush hour: http://www.freegames.ws/games/freegames/cargames/rushhour.htmAnd wrote a computer program to solve it. The algorithm was easy enough:1. pick a car randomly2. move it randomly.3. check if the rad car can exit4. back to step 1.This solution of course solves ...

iText font

368 byte By patmugaa at 2007-10-3 5:52:14
Does anyone know how I can use arial Font in iText.Currently I am using Times_ROMAN because iText has no Arial_NarrowFont font= FontFactory.getFont(FontFactory.TIMES_ROMAN, 10, Font.NORMAL);table.addCell(new Phrase("Company:",font), new ...

Selection Sort

963 byte By JuppieJuxa at 2007-10-3 5:56:58
I was given this algorithm ALGORITHM SelectionSort(A[0...n-10)//Sorts a given array by selection sort//Input: An array A[0....n-1] of orderable elements//Output: Array A[0.....n-1] sorted in ascending orderfor i = 0 to n-2 domin = 1for j = i + 1 to n-1 doif A[j[ < A[min]min = jswap A[ i ] ...

Setting range for array

761 byte By JuppieJuxa at 2007-10-3 5:57:02
I need to set the range of numbers for my array where by I need to give a set maximum and minimum number to my array. This is what I thought up off but it isn't very efficient cause it will take too long for my program to executedo{for (int i=0; i<array.length-2; i++){array[ i ] = ( 1 + ...

SecureRandom best practice?

579 byte By LuisKarlosa at 2007-10-3 6:01:58
Maybe someone can help me with this.So far I found that SecureRandom is better than Math.rand, but is hard to find something like a best practice for SecureRandom, for example:1. How long the seed must be?2. I am going to use the SecureRandom for multiple games, should I use a global ...

permutations

340 byte By nocturncala at 2007-10-3 6:02:10
I am having a problem designing a code that deals with permutations recursively. What i am trying to do is design the code so that it takes in a phone number and gives me all the permutations of the number. the mapping from number to letter is just like the letters on a phone keypad. 1 and 0 ...

Distribution count sorting

2145 byte By JuppieJuxa at 2007-10-3 6:04:06
I have written this piece of code:public static String DistributionCountingSort(int array3[], int firstindex1, int lastindex1, int arraySize1){int arrayrange = firstindex1 - lastindex1;//lastindex1 is 'l' and firstindex1 is 'u'int DArray[] = new int[arraySize1];int SArray[] = new ...

formatting string

121 byte By echizena at 2007-10-3 6:10:59
how do i store an int say value 6 and store it in as a string to hold "00006" in the string. thanks.