-
Optimization of code
Hi,
I need some help regarding the following code.
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
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?
i wouldn't mind not using an array for this.
-
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 question