
1
CSCE 310 Data Structures & Algorithms
Fall 2004
Steve Goddard
Homework 5, December 6th
Practice Test: Review Aid
• This assignment is NEVER due. It is provided to assist in your preparation for
the final examination.
____________________________________________________________
1. Illustrate the operation of merge sort on the array A = (3, 41, 52, 26, 38, 57, 9, 49). Show each level of recursion in
your work.
2. You have studied the binary heap. Consider a ternary heap, where each non-leaf node has 3 children instead of 2.
What is the height of this heap in terms in terms of n?
3. Prove by induction on n that ∑
=
++
=
n
i
nnn
i
1
23
2
6
32 . Similarly, prove by induction k that ∑
=
+−=
k
i
ki
0
1122 .
4. Explain the effect of both an algorithms’ constant factor and it’s asymptotic growth. Give a numerical example that
shows the conditions where each factor dominates.
5. What is the primary purpose of presenting the ADT methodology? What are other advantages?
6. List in order of most general to most specialized, the following data structures: Indicate where they could be
considered into be on the same level. Give reasoning for your ranking and how the level becomes more specialized.
Binary tree, tree, AVL tree, binary search tree, heap, priority queue.
7. Indicate how a stack and a queue differ from each other. How are they the same? Give an example of an
application in which they would be used.
8. Give a definition of height and depth when used in conjunction with a binary tree. How are the two terms different?
9. Consider recursion and mathematical induction. How can the two be seen to be related?
10. When traversing a tree, there are three methods of doing this: pre-order, in-order, and post-order. Draw a tree of at
least height 4 and give the traversal using each of these three methods. To make the exercise meaningful, make each
node of the tree unique.
11. How does quick sort differ from merge sort? They both divide an array, so what’s the difference? Give aspects of
asymptotic growth, space usage and any other feature where they can be compared.