

Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
Material Type: Exam; Class: ALGS/DATA STRUCTURES; Subject: COMPUTER SCIENCE; University: Clemson University; Term: Summer 1 2009;
Typology: Exams
1 / 2
This page cannot be seen from the preview
Don't miss anything!


Some thoughts on Third Practice Test
Q1) In level-order the values are 3, 4, 9, 5, 6, 10, 16
Q2) a) Priority Queue b)
int Tig::returnSecondSmallest( ) { if( isEmpty() ) return -1; int min = removeMin(); int toReturn = -1; if( !isEmpty() ) toReturn = removeMin(); insertItem(min); return toReturn; }
Q3) Many answers, all 28 bits. All have T encoded with 2 bits.
Q4) a) O(n log n) and O(n log n) b) O(n log n) and O(n^2 ) c) O(1) and O(n)
Q5) a) 3. b) 5. c) 7
Q6) (assuming if even-length array then “middle” element is the central element with smaller index) So: pivot is median(1,3,2)= quicksort([1]) does nothing quicksort([4,7,3,5,8,6]) chooses pivot median(4,3,6)= and so on
template
template