Results 1 to 3 of 3
  1. #1
    Metastar's Avatar
    Metastar is offline Member
    Join Date
    Jul 2010
    Posts
    62
    Rep Power
    0

    Default Problem with linear search

    I can't for the life of me grasp this search and it's really getting to me at this point. This is what I've got so far and maybe someone can point out where I've gone wrong.

    Java Code:
    public String linearSearch(Country[] myCountries, int first1, int last1, 
               String searchKey)
        {
            for(int i = 0; i < myCountries.length; i++)
            {
                boolean success;
                success = linearSearch(myCountries, int first2, int last2, String     input[i]);
                System.out.println("Success: " + success + " " + myCountries[j].getCountryCode());
            }//end for
        }//end linearSearch
    I also need to return whether or not I found a hit or not, how many probes it took, and return it in the form:

    found: the search key , probes: x

    I dont have a return in here yet because I don't understand what I'm doing wrong here.

  2. #2
    Zack's Avatar
    Zack is offline Senior Member
    Join Date
    Jun 2010
    Location
    Destiny Islands
    Posts
    692
    Rep Power
    4

  3. #3
    Metastar's Avatar
    Metastar is offline Member
    Join Date
    Jul 2010
    Posts
    62
    Rep Power
    0

Similar Threads

  1. problem with linear search
    By Metastar in forum New To Java
    Replies: 14
    Last Post: 09-14-2010, 08:01 PM
  2. linear systems of equations
    By tyang in forum New To Java
    Replies: 2
    Last Post: 03-24-2010, 03:13 PM
  3. Replies: 1
    Last Post: 03-11-2010, 12:49 AM
  4. Hash table with linear probing
    By Java Tip in forum java.lang
    Replies: 0
    Last Post: 04-12-2008, 08:43 PM
  5. Help me(Linear Multiobjective programming)
    By vinaytvijayan in forum Advanced Java
    Replies: 2
    Last Post: 01-22-2008, 07:24 AM

Posting Permissions

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