Jacob_Thomas

Menu

Jan 28th, 2021
437
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.89 KB | None | 0 0
  1. import java.util.*;
  2. class switch_case{
  3.     public static void main(String args[]){
  4.         Scanner sc = new Scanner(System.in);
  5.         System.out.println("Press 1 for linear search \nPress 2 for Binary search \nPress 3 for Insertion sort \nPress 4 for Counting sort \nPress 5 for Quicksort\nPress 6 for Merge sort\nPress 7 for KMP\nPress 8 for NaiveString\nPress 9 for lps\nPress 10 for heapsort\nPress 11 for kmp\nPress 12 for prims\nPress 13 for LCS\nPress 14 for BST insertion\nPress 15 for Kruskals\n\n\n\n");
  6.         int input = sc.nextInt();
  7.         if(input == 1){
  8.             new LinearSearch().main(new String[0]);
  9.         }
  10.         if(input == 2){
  11.             new BinarySearch().main(new String[0]);
  12.  
  13.         }
  14.         if(input == 3){
  15.             new InsertionSort().main(new String[0]);
  16.         }
  17.         if(input == 4){
  18.             new CountSort().main(new String[0]);
  19.         }
  20.         if(input == 5){
  21.             new Quicksort().main(new String[0]);
  22.         }
  23.         if(input == 6){
  24.             new mergesort().main(new String[0]);
  25.         }
  26.         if(input == 7){
  27.             new kmp().main(new String[0]);
  28.         }
  29.         if(input == 8){
  30.             new Naive_string().main(new String[0]);
  31.         }
  32.         if(input == 9){
  33.             new lps().main(new String[0]);
  34.         }
  35.         if(input == 10){
  36.             new HeapSort().main(new String[0]);
  37.         }
  38.         if(input == 11){
  39.             new rabin_karp().main(new String[0]);
  40.         }
  41.         if(input == 12){
  42.             new prims().main(new String[0]);
  43.         }
  44.         if(input == 13){
  45.             new LCS().main(new String[0]);
  46.         }if(input == 14){
  47.             new BstInsert().main(new String[0]);
  48.         }
  49.         if(input == 15){
  50.             new Kruskals().main(new String[0]);
  51.         }
  52.         if(input < 1 && input > 15){
  53.         System.out.println("Wrong choice");
  54.         }
  55.  
  56.     }
  57. }
Advertisement
Add Comment
Please, Sign In to add comment