❧

Exercises

Fig. 4.2?

4.2. Define the data structure described in the last paragraph of Section 4.2 in

display
275
display

4.3. Assume that a first-in-first-out queue Q with elements of type To is imple-

display

4.4. Assume that the records of a linked list contain a key field of type integer.

display

4.5. Circular lists (see Fig. 4.54) are usually set up with a so-called list header.

Fig. 4.54 Circular list.

4.6. A bidirectional list is a list of elements that are linked in both ways. (See Fig.

Fig. 4.55 Bidirectional list.

4.7. Does Program 4.2 work correctly if a certain pair <x, y> occurs more than

display
276

4.9. Write a program that reads a program text, identifies all procedure (subrou-

display

4.10. Draw the tree constructed by Program 4.3 if the input consists of the

display

4.11. What are the sequences of nodes encountered when traversing the tree of

Fig. 4.23 in preorder, inorder, and postorder?

4.12, Find a composition rule for the sequence of m numbers which, if applied to

Program 4.4, yields a perfectly balanced tree.

display

4.14. Define a data structure to represent n-ary trees. Then write a procedure

display

4.15. Assume that a tree is built upon the following definition of a recursive data

structure (see Exercise 4.1).

display

4.16. Ina file system a catalog of all files is organized as an ordered binary tree.

display

4.17. Ina tree structure the frequency of access of each element is measured empir-

display
277

4.18. The method of analyzing the tree insertion algorithm described in Sect. 4.5

display

4.19. Draw the balanced tree with 12 nodes which has the maximum height of

display

4.20. Find a sequence of x insertion keys so that procedure (4.63) performs each

display

4.21. Find a balanced tree with keys |... and a permutation of these keys so

display

4.22. What is the average path length of the Fibonacci-tree T7,,?

4.23. Write a program that generates a nearly optimal tree according to the

display

4.24. Assume that the keys 1, 2, 3,... are inserted into an empty B-tree of order

display

4.25. Write a program for the search, insertion, and deletion of keys in a binary

Fig. 4.51.

4.26. Find a sequence of insertion keys which, starting from the empty symmetric

display

4.27. Write a procedure for the deletion of elements in a symmetric binary B-tree.

display

4.28. Compare the performances of the insertion and deletion algorithm of binary

display

4.29. Modify the printing algorithm of Program 4.6 in such a way that it can be

display
278

4.30. If the amount of information associated with each key is relatively large

display

4.31. Consider the proposal to solve the clustering problem by constructing over-

display

4.32. Devise a scheme that performs insertions and deletions in a hash table

display

4.33. The primary drawback of the hash table technique is that the size of the

display

4.34. Very often keys are not integers but sequences of letters. These words may

display
↑ Up