08Summer - CSE 2320 Name _ Test 1 Summer 2008 Last 4 Digits...

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

View Full Document Right Arrow Icon
CSE 2320 Name ____________________________________ Test 1 Summer 2008 Last 4 Digits of Mav ID # _____________________ Multiple Choice. Write your answer to the LEFT of each problem. 3 points each 1. The time for the following code is in which set? for (i=0; i<n; i++) for (j=0; j<n; j++) { c[i][j] = 0; for (k=0; k<n; k++) c[i][j] += a[i][k]*b[k][j]; } A. Θ (n) B. Θ (n log n) C. Θ (n 2 ) D. Θ (n 3 ) 2. The fractional knapsack problem may be solved optimally by a greedy method by taking a fraction of no more than this number of items. A. 0 B. 1 C. 2 D. 3 3. 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. 4. What is the value of H 3 ? A. lg 3 B. 1 3 C. 11 6 D. 3 5. f n ( ) = n lg n is in all of the following sets, except A. Ο log n ( ) B. Θ log n ! ( ) ( ) C. 1 n ( ) D. Ο n 2 ae è ç ö ø ÷ 6. Which of the following is not true? A. n 3 Î W n 2 ae è ç ö ø ÷ B. n log n Î O n 2 ae è ç ö ø ÷ C. g n ( ) Î O f n ( ) ( ) Û f n ( ) Î W g n ( ) ( ) D. loglog n Î Wlog n ( ) 7. Suppose a binary search is to be performed on a table with 50 elements. The maximum number of elements that could be examined (probes) is: A. 4 B. 5 C. 6 D. 7 8. Which of the following functions is not in n 2 ae è ç ö ø ÷ ? A. n B. n 2 C. n 2 lg n D. n 3 9. Which of the following is not true for the activity scheduling problem? A. The activities may have various durations. B. The greedy solution is optimal. C. There may be several optimal solutions. D. The goal is to minimize the number of activities chosen. 10. The subset sum problem takes n input values and attempts to find a combination of those values whose sum is m . The worst-case time to extract the solution from the dynamic programming table is: A. Θ log m ( ) B. Θ n ( ) C. Θ m ( ) D. Θ mn ( ) 11. 4 lg7 evaluates to which of the following? (Recall that lg x = log 2 x .) A. 7 B. 7 C. 30 D. 49 12. Suppose you are using the substitution method to establish a Θ bound on a recurrence T n ( ) and that you already know
Background image of page 1

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

View Full DocumentRight Arrow Icon
that T n ( ) Î Wlg n ( ) and T n ( ) Î O n 2 ae è ç ö ø ÷ . Which of the following cannot be shown as an improvement? A. T n ( ) Î O lg n ( ) B. T n ( ) Î O n ( ) C. T n ( ) Î W n 2 ae è ç ö ø ÷ D. T n ( ) Î W n 3 ae è ç ö ø ÷ 13. The number of calls to getmin to build a Huffman code tree for n symbols is: A. Θ log n ( ) B. n - 1 C. n D. 2 n - 2 14. Which situation for operating on a maxheap uses a swim ? A. decreaseKey B. getmax C. insert D. heapsort 15. The time to extract the LCS (for sequences of lengths m and n ) after filling in the dynamic programming matrix is in: A. Θ ( n ) B. Θ ( m + n ) C. Θ ( n log n ) D. Θ ( mn ) Long Answer 1. Use dynamic programming to find a subset of {1, 2, 4, 7, 11} that sums to 13. (No credit for solving by inspection.) 10
Background image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 03/25/2012 for the course CSE 2320 taught by Professor Bobweems during the Spring '12 term at UT Arlington.

Page1 / 10

08Summer - CSE 2320 Name _ Test 1 Summer 2008 Last 4 Digits...

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

View Full Document Right Arrow Icon
Ask a homework question - tutors are online