Results 1 to 2 of 2
Thread: Optimization of code
- 08-16-2009, 08:42 PM #1
Member
- Join Date
- Aug 2009
- Posts
- 17
- Rep Power
- 0
Optimization of code
Hi,
I need some help regarding the following code.
What I want is I am storing the word difference between 2 strings in an array m. and I want the least value from that array. the problem is that array is very big. so sorting it takes time. can anyone suggest how do i get the least word diff in shorter time?Java Code:public static void main(String[] args) throws IOException { //int mindiff = 100 , k = 0, diff = 0; String wordList[], words[]; breathalyzer b = new breathalyzer(); wordList = b.readWordList(); words = b.readInput(args[0]); int m[] = new int[wordList.length]; int i,j; for(i=0; i<words.length; i++) { for(j=0; j<wordList.length; j++) { if(words[i] != null && wordList[j] != null) { m[j] = b.wordDifference(words[i] , wordList[j]); } } } }//End of main
i wouldn't mind not using an array for this.Last edited by new_coder; 08-16-2009 at 09:07 PM.
- 08-16-2009, 09:38 PM #2
Senior Member
- Join Date
- Mar 2009
- Posts
- 552
- Rep Power
- 5
Double-posted in advanced java, if this thread could be closed my a moderatoer, that would be great.
@OP please do not double-post, choose the forum you think best suits your questionIf the above doesn't make sense to you, ignore it, but remember it - might be useful!
And if you just randomly taught yourself to program, well... you're just like me!
Similar Threads
-
Query Optimization
By gilbertsavier in forum JDBCReplies: 0Last Post: 08-05-2009, 10:36 AM -
A Webservice Platform for Transport Optimization
By dnaevolutions in forum Java SoftwareReplies: 0Last Post: 01-18-2009, 06:15 PM -
toHexString optimization (in fact general optimization question)
By jann in forum Advanced JavaReplies: 7Last Post: 12-16-2008, 06:44 PM -
java code optimization
By hey in forum New To JavaReplies: 0Last Post: 02-10-2008, 05:16 PM -
Optimization Algorithm Toolkit 1.3
By JavaBean in forum Java SoftwareReplies: 0Last Post: 07-14-2007, 08:24 PM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks