Write pseudocode for the procedure CONSTRUCT-OPTIMAL-BST(root) which, given the table root, outputs the structure of an optimal
Question:
Write pseudocode for the procedure CONSTRUCT-OPTIMAL-BST(root) which, given the table root, outputs the structure of an optimal binary search tree. For the example in Figure 15.10, your procedure should print out the structure
Figure 15.10
k2 is the root
k1 is the left child of?k2
d0 is the left child of?k1
d1 is the right child of?k1
k5 is the right child of?k2
k4 is the left child of?k5
k3 is the left child of?k4
d2 is the left child of?k3
d3 is the right child of?k3
d4 is the right child of?k4
d5 is the right child of?k5
corresponding to the optimal binary search tree shown in Figure 15.9(b).
Fantastic news! We've Found the answer you've been seeking!
Step by Step Answer:
Related Book For
Introduction to Algorithms
ISBN: 978-0262033848
3rd edition
Authors: Thomas H. Cormen, Charles E. Leiserson, Ronald L. Rivest
Question Posted: