CSE 2320 Section 060/061 Spring 1999

**Homework 2**

Due: February 18, 1999, in class (February 19, 1999, 5:00pm for -10%)

Due: February 18, 1999, in class (February 19, 1999, 5:00pm for -10%)

- 1.
- Solve the following recurrence using the iteration method and verify
your solution using the substitution method.

- 2.
- Solve the following recurrence using the iteration method and verify
your solution using the substitution method.

- 3.
- 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.
- 4.
- Draw a binary tree illustrating the execution of QUICKSORT on
the array

. Each node contains the subarray passed into the recursive calls to QUICKSORT from their parent node. The root node contains the original array*A*. - 5.
- 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.