

Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!


Note: All work turned in must be handwritten and represent the individual, original work of the student.
Given a chain of five matrices A 1 , A 2 , A 3 , A 4 , A 5. The dimensions of the matrices are:
A 1 : 4 × 5 A 2 : 5 × 8 A 3 : 8 × 10 A 4 : 10 × 3 A 5 : 3 × 4
Solve the matrix-chain problem above using dynamic programming. Compute the minimum cost and present the required parenthesization. (Hint: Refer to the lecture slides and in-class practice problem.)
Let S = {a, b, c, d, e, f, g} be a collection of objects with benefit-weight values as follows:
a b c d e f g Benefit 10 9 7 11 13 7 8 Weight 4 6 5 6 3 1 6
Solve the 0-1 Knapsack problem for the item collection S with a knapsack capacity of 18. You must show your complete work (such as the dynamic programming state matrix) and list the final optimal selection of objects along with their combined benefit.
Write down the recurrence relation for the well-known minimum Coin Change Problem used in dynamic programming. In other words, give the change for amount n using the minimum number of coins of denominations d 1 < d 2 < · · · < dm. Next, demonstrate how the solution is built step by step using a concrete example. (Hint: Refer to the in-class practice problem.)
Explain, in your own words, one linear-time sorting algorithm and illustrate how it works with an example. Also explain why the algorithm has a linear running time. (Hint: Refer to the lecture slides.)
Prove that the height of an AVL tree is O(log n). (Hint: Refer to the lecture slides.)
Show the AVL tree that results after each of the integer keys 9, 7, 5, 10, 28, 21, 41, 3, 19, 22, 35, 13, 40, 14, 11, 26 and 20 are inserted, in that order, into an initially empty AVL tree. Clearly show the tree after each insertion, and clearly indicate any rotations that need to be performed.
Starting with the AVL tree shown below, perform a delete ‘10’ operation. Show the tree after each operation, as well as after any intermediate restructuring steps performed.
Figure 1: Initial AVL Tree Structure