{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

# 04Fall - CSE 2320 Name Test 1 Fall 2004 Student ID Multiple...

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

CSE 2320 Name ________________________________ Test 1 Fall 2004 Student ID # ___________________________ Multiple Choice. Write your answer to the LEFT of each problem. 4 points each 1. Counting sort is useful for implementing which other sort? A. I NSERTION -S ORT B. LSD radix sort C. M ERGE -S ORT D. Q UICKSORT 2. I NSERTION -S ORT is the basis for which other sorting algorithm? A. LSD radix sort B. M ERGE -S ORT C. Q UICKSORT D. S HELL -S ORT 3. Which of the following sorting algorithms applies divide-and-conquer? A. H EAP -S ORT B. I NSERTION -S ORT C. LSD radix sort D. Q UICKSORT 4. Which of the following functions is not in n 2 ae è ç ö ø ÷ ? A. n B. n 2 C. n 2 lg n D. n 3 5. Suppose that a binary search is to be performed on a table with 20 elements. The maximum number of elements that could be examined (probes) is: A. 4 B. 5 C. 6 D. 7 6. The function n + log n is in which set? A. n log n ( ) B. Θ log n ( ) C. Θ n ( ) D. Θ n log n ( ) 7. 4 lg7 evaluates to which of the following? (Recall that lg x = log 2 x .) A. 7 B. 7 C. 30 D. 49 8. A sort is said to be stable when: A. Duplicate copies of a key will appear in the same order in the output as in the input. B. It removes duplicate copies of any key in the final output. C. It runs in Ο n log n ( ) time. D. The average time and the worst-case time are the same. 9. Suppose f x ( ) is a monotonically increasing function. Which of the following approximates the summation? A. f ( x ) dx m n ò £ f ( k ) k = m n å £ f ( x ) dx m n ò B. f ( x ) dx m -1 n ò £ f ( k ) k = m n å £ f ( x ) dx m n +1 ò

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

View Full Document
C. f ( x ) dx m -1 n -1 ò £ f ( k ) k = m n å £ f ( x ) dx m +1 n +1 ò D. f ( x ) dx m n +1 ò £ f ( k ) k = m n å £ f ( x ) dx m -1 n ò 10. Which of the following will not be true regarding the decision tree for Q UICKSORT 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 ae è ç ö ø ÷ decisions. D. There will be n ! leaves. Long Answer 1. Prove that if f ( n ) Î O g ( n ) ( ) then g n ( ) Î W f n ( ) ( ) . 10 points 2. List the four phases in a counting sort and the time for each. 5 points 3. Use the substitution method to show that T n ( ) = 2 T n 2 ( ) + n 2 is in Θ n 2 ae è ç ö ø ÷ . 15 points 4. Use the recursion-tree method to show that T n ( ) = 2 T n 2 ( ) + n 2 is in Θ n 2 ae è ç ö ø ÷ . 15 points 5. Demonstrate P ARTITION on the following array. 10 points 5 6 7 8 9 0 1 2 3 4 6. Give two ways that heaps are relevant to mergesort with external devices. 5 points CSE 2320 Name ________________________________ Test 2 Fall 2004 Student ID # ___________________________ Multiple Choice. Write the letter of your answer to the LEFT of each problem. 4 points each 1. The stack for rat-in-a-maze stores
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

### Page1 / 7

04Fall - CSE 2320 Name Test 1 Fall 2004 Student ID Multiple...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document
Ask a homework question - tutors are online