{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

Exam3_Review_Soln

# Exam3_Review_Soln - COP 3502 Exam 3 Review Thursday April 2...

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

COP 3502 - Exam 3 Review Thursday April 2, 2009 1. From a past foundation exam: Given the array [37, 21, 28, 6, 2, 23, 35, 17, 44, 4, 11, 33, 18] show the state of the array after each pass when the following sorting algorithms ((a) Insertion Sort, (b) Bubble Sort, and (c) Selection Sort) are applied on the original array for three (3) passes. a) Insertion Sort Pass 1: [21, 37 | 28, 6, 2, 23, 35, 17, 44, 4, 11, 33, 18] Pass 2: [21, 28, 37 | 6, 2, 23, 35, 17, 44, 4, 11, 33, 18] Pass 3: [6, 21, 28, 37 | 2, 23, 35, 17, 44, 4, 11, 33, 18] b) Bubble Sort Pass 1: [21, 28, 6, 2, 23, 35, 17, 37, 4, 11, 33, 18, | 44] Pass 2: [21, 6, 2, 23, 28, 17, 35, 4, 11, 33, 18, | 37, 44] Pass 3: [6, 2, 21, 23, 17, 28, 4, 11, 33, 18, | 35, 37, 44] c) Selection Sort Pass 1: [2, 21, 28, 6, 37, 23, 35, 17, 44, 4, 11, 33, 18] Pass 2: [2, 4, 28, 6, 37, 23, 35, 17, 44, 21, 11, 33, 18] Pass 3: [2, 4, 6, 28, 37, 23, 35, 17, 44, 21, 11, 33, 18] 2. Insert the following values into a hash table of size 10 using the hash equation 3. (x 2 +1) % 10 using the quadratic probing technique. Insert these values in sequential order: 1,2,5,6,8.

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

View Full Document
0 1 2 3 4 5 6 7 8 9 1 2 5 7 8 1: Index to store = (1 2 + 1) %10 = 2 2: Index to store = (2 2 + 1) %10 = 5 5: Index to store = (5 2 + 1) %10 = 6 6: Index to store = (6 2 + 1) %10 = 7 8: Index to store = (8 2
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}