CSE 2320 Section 501/571 Fall 1999
Due: September 28, 1999, in class (September 29, 1999, 5:00pm for -10%)
- Show the operation of HEAPSORT on the array
Specifically, show the
binary-tree version of the heap and the array contents after the
initial call to BUILD-HEAP and after each call to HEAPIFY
in line 5 of the pseudocode on page 147.
- Draw a binary tree illustrating the execution of QUICKSORT on
10, 4, 15, 7, 23, 6, 15, 14, 16, 20 .
Each node contains the subarray
passed into the recursive
calls to QUICKSORT from their parent node. The root node contains
the original array A.
- Show the operation of COUNTING-SORT on the array
Specifically, first show
the C array after completion of the for loop in lines 6-7 of
the pseudocode on page 176. Then, show the B and C array after
each iteration through the for loop in lines 9-11.
- For each of the following arrays, select which of the five sorts
INSERTSORT, MERGESORT, HEAPSORT, QUICKSORT or
COUNTINGSORT (as implemented in the textbook) will run fastest (non-asymptotically speaking). Describe any assumptions about the cost of
operations within the sorting algorithms and justify your answers.
- Array A[1..100], where
A[i] = 1000(101 - i).
- For each of the following types of data structures, show the final
data structure after inserting the keys 4, 2, 6, 7, 6, 5 in this order into
an initially empty data structure.
- Stack, using an array. Be sure to indicate the top of the
- Queue, using an array. Be sure to indicate the head and tail of the queue.
- Singly-linked list. Be sure to indicate the head of the list.
- Doubly-linked list. Be sure to indicate the head of the list.
- Doubly-linked list with sentinel. Be sure to indicate the sentinel of the list.