Title: Data Structure Activities
1Data Structure Activities
- Richard Anderson
- University of Washington
2Decode the following
11010010010101011
100100101010
Ambiguous
Prefix code
3Construct the tree for the following code
4Draw a Huffman tree for the following data values
and show internal weights3, 5, 9, 14, 16, 35
5Delete 10 replace w. smallest in right subtree
10
20
20
7
25
10
15
30
9
2
30
18
2
11
17
Student Activity
6AVL Trees
- What is the most important aspect of AVL trees?
7ZIG-ZAG
Show the ZIG-ZAG transformation to bring X to the
root
Z
Y
A
D
X
B
C
8Splay E (submit your answer)
E
I
A
H
B
A
G
C
I
D
F
B
H
C
G
D
F
E
9Splay Trees
- What is the most important aspect of Splay trees?
10Draw an in-tree representation of the following
equivalence relation
1,11, 2, 4, 6, 8, 10, 12, 3, 5, 7, 9, 13,
14, 15
111 2 3 4 5 6 7
-1
1
-1
7
7
5
-1
Up
int Find(xint)
3
Give the code for the find operation
Student Activity
12Binomial Trees
- Draw B4
- What is the height of Bk?
- What is the weight of Bk?
13Comparing Priority Queues
Student Activity
14Resolving Collisions with Double Hashing
Student Activity
- Hash Functions
- H(K) K mod M
- H2(K) 1 ((K/M) mod (M-1))
- M 10
Insert these values into the hash table in this
order. Resolve any collisions with double
hashing 13 28 33 147 43
15Sort Properties
Student Activity
- Are the following stable? in-place?
- Insertion Sort?
-
- Selection Sort?
- MergeSort?
-
- QuickSort?
-
- Radix Sort
16RadixSort
Student Activity
- Input126, 328, 636, 341, 416, 131, 328
BucketSort on lsd
BucketSort on next-higher digit
BucketSort on msd