Results 1 to 2 of 2
  1. #1
    new_coder is offline Member
    Join Date
    Aug 2009
    Rep Power

    Question Optimization of code


    I need some help regarding the following code.

    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
    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.
    Last edited by new_coder; 08-16-2009 at 09:07 PM.

  2. #2
    Singing Boyo is offline Senior Member
    Join Date
    Mar 2009
    Rep Power


    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
    If 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

  1. Query Optimization
    By gilbertsavier in forum JDBC
    Replies: 0
    Last Post: 08-05-2009, 10:36 AM
  2. A Webservice Platform for Transport Optimization
    By dnaevolutions in forum Java Software
    Replies: 0
    Last Post: 01-18-2009, 07:15 PM
  3. Replies: 7
    Last Post: 12-16-2008, 07:44 PM
  4. java code optimization
    By hey in forum New To Java
    Replies: 0
    Last Post: 02-10-2008, 06:16 PM
  5. Optimization Algorithm Toolkit 1.3
    By JavaBean in forum Java Software
    Replies: 0
    Last Post: 07-14-2007, 08:24 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts