JavaSearchAssignment.java

From WLCS
Revision as of 22:31, 14 September 2014 by Admin (talk | contribs) (Created page with "import java.util.Scanner; import java.util.Arrays; public class JavaSearchAssignment { public static void main( String [] args ) { Scanner scanner = new Scanner(...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

import java.util.Scanner; import java.util.Arrays;

public class JavaSearchAssignment {

   public static void main( String [] args )
   {
       Scanner scanner = new Scanner(System.in);
       
       int [] nums = { 604, 565, 449, 69, 869, 965, 506, 145, 913, 874, 987, 315, 967, 543, 
                       675, 571, 388, 167, 259, 331, 47, 863, 970, 890, 312, 109, 360, 993, 
                       176, 490, 34, 637, 712, 721, 552, 914, 425, 551, 274, 346, 516, 922, 
                       823, 540, 12, 53, 689, 159, 388, 285, 95, 554, 932, 755, 560, 676, 152, 
                       912, 816, 82, 974, 518, 502, 765, 191, 176, 613, 627, 233, 995, 864, 
                       316, 151, 169, 264, 367, 928, 841, 330, 368, 457, 843, 688, 599, 959, 
                       67, 393, 253, 675, 46, 595, 864, 44, 425, 573, 994, 271, 781, 638, 138 };

       //Print the array

       //Prompt user for a search key
       
       //Implement linear search here
       
       
       Arrays.sort(nums); //Sorts the list for binary search
       
       //Print the array
       
       //Prompt user for a search key
       
       //Implement binary search here
       
   }

}