CISC 320 review sheet for first midterm exam

Exam covers Chapters 4 (trees), 6 (analysis), 8 (insertion sort), 9 (quicksort, selection), 11 (heapsort, priority queues), 12 (mergesort - less emphasis), 14 (searching), 15 (2-3-4 trees, red-black trees), 16 (hashing), 18 (B-trees only). 19 (knuth-morris-pratt algorithm only). The old exam, handed out, is NOT representative of what you can expect. Nonetheless it shows where the emphasis is on comparing the merits of various algorithms for searching and sorting. Questions on this exam will be true/false or short answer, for the most part. You might be asked to complete or modify the implementation of an algorithm.

study guide (sample questions)

  1. Which sorting method guarantees worst case time of O(n log(n))?
  2. An element can be inserted in a heap by placing it at the end, increment n (the size of the heap) and calling upheap. What does upheap do?
  3. Which sorting method is particularly good on almost sorted lists?
  4. Give a precise definition of "almost sorted" for the purpose of the preceeding question.
  5. Give an example of a case where sorting of an almost sorted list comes up.
  6. What sorting method we've studied is best on large "random" arrays?
  7. What sorting method is best on short arrays? How short?
  8. What disadvantage does mergesort have relative to quicksort?
  9. What disadvantage does quicksort have relative to mergesort?
  10. What is the maximum number of nodes in an order 2 B-tree?
  11. What is the maximum number of records (keys and associated data) in an order 2 B-tree, when all data is stored at the leaves.
  12. What is the range of depths at which leaves might occur in a red-black tree with 31 keys?
  13. What is the black death? Oh, sorry, that's medieval history 101.
    What is the black depth of a node in a red-black tree?
    What is the range of possible black depths of leaves in a red-black tree with 31 nodes?
  14. What does the "rotate" function do in red-black trees. Which of the basic dictionary functions call rotate in the red-black implementation
  15. What advantage does a hash table have over a balanced tree for searching?
  16. what advantage does a balanced tree have over a hash table?
  17. which searching method guarantees each search, insert, and delete takes no more than O(log(n)) comparisons, on a dictionary containing n keys?
  18. What does the Knuth-Morris-Pratt algorithm do? How does it do it?

saunders@cis.udel.edu