NAME: Midterm Exam |
March 14, 2001 Computer Science 226 |
This test is 11 questions for a total of 99 points, weighted as indicated. Do all of your work on these pages (use the back for scratch space), giving the answer in the space provided. Put your name on every page (now), and write out and sign the Honor Code pledge before turning in the test.
``I pledge my honor that I have not violated the Honor Code during
this examination.''
1. ___/15 2. ___/8 3. ___/8 4. ___/8 5. ___/8 6. ___/8 7. ___/8 8. ___/8 9. ___/8 10. ___/10 11. ___/10 TOTAL: ___/99
_______ insertion sort A. linear extra space _______ selection sort B. optimal average running time _______ heapsort C. linear best-case running time _______ bubblesort D. quadratic worst-case running time _______ mergesort E. linear for nearly-ordered files _______ quicksort F. optimal worst-case running time _______ shellsort G. quadratic best-case running time
A F E D C B G H Iin that order into an initially empty queue. Use left-heap-ordered power-of-2 trees.
A F E D C B G H Iin that order into an initially empty tree.
A F E D C B G H Iin that order into an initially empty tree, using the root insertion method.
A G F E D C B H I Jin that order into an initially empty tree.
1101 0100 0011 0010 0001 1000 1001in that order into an initially empty trie.
1101 0100 0011 0010 0001 1000 1001in that order into an initially empty trie.
C E A G B D Fwhen inserted in the order given into an initially empty tree.
C A B E G D F C A E G D B F C E B G A D F C E G A F D B C E G D F A B E A G B D F Cb. (7 points) How many of 7! = 5040 orders in which to insert the keys produce the same tree as
C E A G B D Fwhen inserted into an initially empty tree?
___ splay tree A. O(1) ___ red-black tree B. O(log N) ___ BST C. O(N)