ReviewProblems4

# ReviewProblems4 - Faculty of Computers and Information...

This preview shows page 1. Sign up to view the full content.

This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: Faculty of Computers and Information Faculty of Computers and Information Faculty of Computers and Information Faculty of Computers and Information Review Problems 4 Department of Computer Science Data Structures 1. Prove that the number of elements in the left and right sub-trees produced by the binary search (studied in lectures) are given by L = „ n- 1 2 ” = l n 2 m- 1 (1) R = » n- 1 2 … = j n 2 k (2) 2. Give an example of a tree that is not complete, still, with leaves only at the last two levels. 3. Some authors, e.g., (Knuth, 1997, Sec. 2.3.4.5, Eq. (4)), derive the internal path length as: I n = ( n + 1) q- 2 q +1 + 2 , where (3) q = b lg ( n + 1) c (4) This is similar to what we have derived in lectures, except that we had q = b lg n c . (a) Show that b lg ( n + 1) c and b lg n c are not always equal to each other. When are they equal? (b) Show that although b lg ( n + 1) c 6 = b lg n c , both expressions for internal path are exactly the same....
View Full Document

{[ snackBarMessage ]}

Ask a homework question - tutors are online