|
| 1 | +import java.util.Scanner; |
| 2 | +class Search{ |
| 3 | + public void linearsearch(n,arr) |
| 4 | + { |
| 5 | + for |
| 6 | + } |
| 7 | +} |
| 8 | +class Main{ |
| 9 | + public static void main(String[] args) { |
| 10 | + Scanner sc=new Scanner(System.in); |
| 11 | + do{ |
| 12 | + System.out.println("Enter the size of the array:"); |
| 13 | + n=sc.nextInt(); |
| 14 | + int arr[n]; |
| 15 | + for(int i=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 | + int choice; |
| 30 | + |
| 31 | + choice=sc.nextInt(); |
| 32 | + switch(choice) |
| 33 | + { |
| 34 | + case 1: |
| 35 | + System.out.println("Searching Algorithm : Linear Search") |
| 36 | + |
| 37 | + |
| 38 | + } |
| 39 | + |
| 40 | + } |
| 41 | + |
| 42 | + |
| 43 | + |
| 44 | + |
| 45 | + } |
| 46 | +} |
0 commit comments