{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

04Summer

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

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

CSE 2320 Name ________________________________ Test 1 Summer 2004 Student ID # ___________________________ Multiple Choice. Write your answer to the LEFT of each problem. 4 points each 1. Which of the following sorts uses time beyond O(n lg n) in the average case? A. heapsort B. insertion C. merge D. quick 2. Which sort treats keys as several digits and uses a counting sort for each position? 3. Which of the following is an accurate statement? 4. Which function is in both (2 n ) and O(3 n ), but is not in Θ (2 n ) or Θ (3 n )? 5. Which recurrence describes the time used by mergesort? A. T n ( ) = T n 2 ( ) + n B. T n ( ) = 2 T n 2 ( ) + n C. T n ( ) = T n - 1 ( ) + n - 1 D. T n ( ) = T n 2 ( ) +1 6. Which of the following sorts is stable? 7. What is the value of H 3 ? 8. The time for the following code is in which set? for (i=0; i<n; i++) for (j=0; j<n; j++)

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

View Full Document
{ 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 ) 9. Let f(n) and g(n) be asymptotically positive functions. Which of the following is true? 10. After performing P ARTITION , the pivot will be at which position? A. its final position when using Q UICKSORT on the entire array. B. the first element of the subarray. C. the last element of the subarray. D. the median position of the subarray. Long Answer 1. Prove that if 1 f ( n ) Î W 1 g ( n ) æ è ç ö ø ÷ then f ( n ) Î O g ( n ) ( ). 10 points 2. Use the substitution method to show that T n ( ) = 2 T n 4 ( ) +1 is in Θ n ( ) . 15 points 3. Use the recursion-tree method to show that T n ( ) = 2 T n 4 ( ) +1 is in Θ n ( ) . 15 points 4. Demonstrate P ARTITION on the following array. 10 points 9 3 1 8 0 5 6 2 7 4 5. Perform B UILD -M AX -H EAP . 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 CSE 2320 Name ________________________________ Test 2 Summer 2004 Student ID # ___________________________ Multiple Choice. Write the letter of your answer to the LEFT of each problem. 4 points each Problems 1 and 2 refer to the following hash table whose keys are stored by linear probing using h(key, i) = (key + i) % 13. 0 1 2 3 4 5 6 7 8 9 10 11 12 122 110 20 86 87 62 94

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

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

### Page1 / 9

04Summer - CSE 2320 Name Test 1 Summer 2004 Student ID...

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

View Full Document
Ask a homework question - tutors are online