CPSC 355 Midterm Review Questions
1. Construct a 3-d tree using the following dimensions: longitude (˚), latitude (˚),
elevation (meters) for the following geographical points: A(60˚, 54˚, 1200);
B(62˚, 58˚,800); C(65˚, 50˚, 900); D(55˚, 49˚, 1400); E(57˚,
70˚, 1800); F(57˚, 47˚, 150); G(66˚, 52˚, 200); H(64˚, 57˚,
500); I(67˚, 55˚, 300).
2. Construct a 2-d tree using longitude and latitude for the points A to I from Q1.
3. Represent graphically the 2-d tree from Q2 (geometric interpretation).
4. In the 3-d tree from Q1, search for points that have the longitude <59˚. Report these
points. How many comparisons were required?
5. Search for points that have the latitude <55˚. Report these points. How many
comparisons were required ?
6. In the 2-d tree from question 2, search for points that have both the longitude <59˚,
and the latitude <55˚. Report the points and total number of comparisons.
7. Given seven intervals: A[3.5,5]; B[2.2, 3.7], C[1.7, 2.5]; D[1.0,
2.1]; E[3.7, 4.2]; F[4.2,5]; G[2.2,2.7]. Construct an interval tree.
Perform a “stabbing query” – report which intervals contain the point 2.3. How many
intervals from the interval tree were tested on inclusion of this point?
8. Construct a B-tree of order 4 (4 keys in each node) for the following keys:
2,7,15,12,11,33,22,30,41,54,66,69,71,78,84,93,100,17
9. Delete keys 33, and then 84 from the B-tree constructed in Q7.
10. Using coalesced hashing, insert the following values:
15, 17, 4, 8, 20, 28, 26, 5.
Hash function h(key) = key mod 11; increment i(key) = Quotient(key/11) mod 11.
11. Build a hash table for data set from Q 10 using Brent’s method.
12. Build a hash table for data set from Q 10 using Binary Tree method.
13. Using extendible hashing, insert the following keys:
15, 17, 4, 11, 21, 28, 25, 5.
H(key) = key mod 10 + Quotient (key/10). A bucket can contain no more than 2
records. Show how the buckets split and the index increases.
14. In the AVL tree provided below, insert the following values: 1, 30, 32, 35. How does
the AVL tree change? What types of rotations are used to balance the tree?
57
26
72
25
38
63
94
3
37
47
78
15. Build an IPR tree for the following data set:
J,H,G,A,GU,B
Compute IPL (Internal Path Length) of the resulting tree.
16. What is the minimum height of a B-tree of order 5 (5 keys in each node) that stores
100 values?
17. A grid file corresponding to the area [0..7]x[0..7] is used to reference the points. The
points are inserted in the following order: A(3,1), B(2,3), C(6,6), D(7,2), E(2,5),
F(5,4). Maximum two points can be stored in each cell of the grid before overflow
happens. Show how the index of the grid file is modified and the grid is split.