{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

05Summer

05Summer - CSE 2320 Name Test 1 Summer 2005 Last 4 Digits...

This preview shows pages 1–3. Sign up to view the full content.

CSE 2320 Name ____________________________________ Test 1 Summer 2005 Last 4 Digits of Student ID # __________________ Multiple Choice. Write your answer to the LEFT of each problem. 4 points each 1. Suppose you are sorting millions of keys that consist of three decimal digits each. Which of the following sorts uses time beyond O(n lg n) in the worst case? A. counting B. heapsort C. merge D. quick 2. Which sort never compares two inputs (to each other) twice? A. heap B. merge C. quick D. shell 3. Suppose that a binary search is to be performed on a table with 30 elements. The maximum number of elements that could be examined (probes) is: A. 4 B. 5 C. 6 D. 7 4. Which function is in neither (2 n ) nor O(3 n )? A. 2 n + n 2 B. 3 n - n 2 C. 2.5 n D. ln n 5. Which recurrence describes the worst-case time used by Q UICKSORT ? A. T n ( ) = T n 2 ( ) + n B. T n ( ) = 2 T n 2 ( ) + n C. T n ( ) = T n - 1 ( ) + n D. T n ( ) = T n 2 ( ) +1 6. Which of the following sorts is not stable? A. insertion B. mergesort C. radix D. quick 7. What is the value of H 4 - H 3 ? A. lg 4 B. 1 4 C. 11 6 D. 3 8. Which of the following will not be true regarding the decision tree for M ERGE -S ORT for sorting n input values? A. Every path from the root to a leaf will have Ο n log n ( ) decisions. B. The height of the tree is n log n ( ) . C. There will be a path from the root to a leaf with n 2 æ è ç ö ø ÷ decisions. D. There will be n ! leaves. 9. What is the value of 1 3 k k =0 ¥ å ?

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
A. 1 3 B. 2 3 C. 3 2 D. 3 10. Suppose the input to H EAPSORT is always a table of identical integers. The worst-case time will be A. Θ (1) B. Θ (n) C. Θ (n lg n) D. Θ (n 2 ) Long Answer 1. Prove that if g n ( ) Î W f n ( ) ( ) then f ( n ) Î O g ( n ) ( ) . 10 points 2. Suppose that a max-heap is used for the subfile production phase of external mergesort. If the available memory size is m , what is the best case, worst case, and expected case for the size of the subfiles produced? 10 points 3. Use the substitution method to show that T n ( ) = 8 T n 2 ( ) + n 3 is in Θ n 3 lg n æ è ç ö ø ÷ . 10 points 4. Use the recursion-tree method to show that T n ( ) = 8 T n 2 ( ) + n 3 is in Θ n 3 lg n æ è ç ö ø ÷ . 10 points 5. Demonstrate how several executions of P ARTITION may be used to determine the median of the following array. 10 points 9 3 1 8 5 6 2 7 4 6. Perform B UILD -M AX -H EAP and then E XTRACT -M AX (once). 10 points 11 6 1 10 8 4 3 2 5 1 2 3 4 5 6 7 8 9 9 10 7 11 1 2 3 4 5 6 7 8 9 10 11 1 2 3 4 5 6 7 8 9 10 11 CSE 2320 Name ________________________________ Test 2 Summer 2005 Last 4 Digits of Student ID # ___________________________ Multiple Choice. Write the letter of your answer to the LEFT of each problem. 4 points each 1. Why is it common for a circular queue implementation to waste one table element?
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}