|
| 1 | +importjava.util.Scanner; |
| 2 | +classSearch{ |
| 3 | +publicvoidlinearsearch(n,arr) |
| 4 | + { |
| 5 | +for |
| 6 | + } |
| 7 | +} |
| 8 | +classMain{ |
| 9 | +publicstaticvoidmain(String[]args) { |
| 10 | +Scannersc=newScanner(System.in); |
| 11 | +do{ |
| 12 | +System.out.println("Enter the size of the array:"); |
| 13 | +n=sc.nextInt(); |
| 14 | +intarr[n]; |
| 15 | +for(inti=1;i,n;i++) |
| 16 | + { |
| 17 | +arr[i]=sc.nextInt(); |
| 18 | + } |
| 19 | +System.out.println("MENU DRIVEN ARRAY SORT- SEARCH PROGRAM"); |
| 20 | +System.out.println("ALGORITHM - Time Complexity"); |
| 21 | +System.out.println("1.) Linear Search - O(n)"); |
| 22 | +System.out.println("2.) Binary Search - O(logn)"); |
| 23 | +System.out.println("3.) Bubble sort - O(n^2)"); |
| 24 | +System.out.println("4.) Selection sort - O(n^2)"); |
| 25 | +System.out.println("5.) Insertion Sort - O(n^2)"); |
| 26 | +System.out.println("6.) Merge Sort - O(n logn)"); |
| 27 | +System.out.println("7.) Radix sort - O(nk)"); |
| 28 | + |
| 29 | +intchoice; |
| 30 | + |
| 31 | +choice=sc.nextInt(); |
| 32 | +switch(choice) |
| 33 | + { |
| 34 | +case1: |
| 35 | +System.out.println("Searching Algorithm : Linear Search") |
| 36 | + |
| 37 | + |
| 38 | + } |
| 39 | + |
| 40 | + } |
| 41 | + |
| 42 | + |
| 43 | + |
| 44 | + |
| 45 | + } |
| 46 | +} |