Make your own free website on Tripod.com

Topic 13 - Sample Questions - Sorting and Searching (10 days)

  1. Write a Linear search - return index of where name is or a -1 if it is not there
    int search(String [] ar, int ct, String na)

  2. Write a binary search - return index of where name is or a -1 if it is not there
    int binarysearch(String [] ar, int ct, String na)

  3. Write a bubble sort-
    void sort(String [] ar, int ct)

  4. Write a selection sort-
    void sort(String [] ar, int ct)

  5. Write a insertion sort-
    void sort(String [] ar, int ct)

  6. Write a mergesort sort-
    void sort(String [] ar, int ct)

  7. Write a quicksort sort-
    void sort(String [] ar, int ct)


  8. HOME