Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Consider the following algorithm: Algorithm T(r) Input: Root r of a proper binar

ID: 3580184 • Letter: C

Question

Consider the following algorithm: Algorithm T(r) Input: Root r of a proper binary tree. if r is a leaf then return 0 else {p leftarrow T(left child of r) q leftarrow T(right child of r) return p + q + 1} What does the algorithm compute? The number of nodes in the tree. The number of internal nodes in the tree. The number of leaves in the tree. The height of the tree. The number of descendants of r. The smallest AVL-tree of height 1 has 1 key ("smallest" here means "smallest number of key"), the smallest AVL-tree of height 2 has 2 keys, and the smallest AVL tree of height 3 has 1 keys. How many keys does the smallest AVL-tree of height 5 have? 10 11 12 13 14 How many different (2, 4)-trees containing the keys 1, 2, 3, 4 and 3 exist (each key must appears once in each one of these (2, 4)-trees)? 2 3 4 5 6 Consider the following graph. Which edges, and in which order, are selected by Prim's algorithm if it stars at vertex 1? (1, 3), (3, 7), (2, 7). (3, 6). (1, 4), (3, 5) (1, 3), (3, 7), (2, 7), (7, 6), (1, 4). (3, 5) (1, 3), (2, 7), (3, 7), (3, 5), (7, 6), (1, 4) (1, 3), (2, 7), (3, 7), (1, 4). (3, 6), (3, 5) (1, 3), (3, 7), (2, 7). (3, 5), (7, 6), (1, 4)

Explanation / Answer

7. how many different (2,4) trees containing the keys 1,2,3,4 and 5 exist

(c) 4

8. (a) (1,3), (3,7), (2,7), (3,6), (1,4), (3,5)