# CMPSCI 311: Theory of Algorithms

### Due Friday 31 October 2003 in class

#### (or earlier to hand-in box in CMPSCI main office)

Ten of the 11 questions are from [L] -- "B6.1" is written by me and the entire problem statement appears here. Point values are as indicated. There are 100 total points.

• Question B6.1 (10): Prove that the Johnson-Trotter algorithm, as implemented in my solution to Discussion #6, is correct. That is, on input n the code I give prints out all n! permutations of n elements. Note that if so, the algorithm (a) never prints out the same one twice, (b) prints every permutation, and (c) prints n! times. By CMPSCI 250 results you may quote, any two of the properties (a), (b), and (c) imply the third.

• Question 6.2.2, page 208 (10):

• Question 6.2.9, page 209 (5):

• Question 6.2.10, page 209 (10):

• Question 6.3.2, page 217 (10): For (b), also prove the result we stated in class characterizing N(h), the size of the smallest AVL tree of height h, in terms of Fibonacci numbers.

• Question 6.3.5, page 217 (10):

• Question 6.3.7, page 218 (10):

• Question 6.4.2, page 224 (10):

• Question 6.4.5, page 225 (10):

• Question 6.5.5, page 231 (10):