Self-Review Questions

  1. What is the main difference between a FIFO queue and a priority queue?

  2. What is the the Comparable interface?

  3. What is the the Comparator interface?

  4. Given an array of strings
    String[] words = {"Fred","bob","Tom","Mark","john","Steve"};
    

    sort them ignoring the case.

  5. Given an array of email addresses
    String[] words = {"Fred@cmu.edu","Bob@yahoo.com","Tom@gmail.com",
    "Mark@ucla.edu","John@pit.edu", "Steve@microsoft.com"};
    

    sort them by company/institution names.