Data Str & Algorithm HW Solutions 42

Data Str & Algorithm HW Solutions 42 - 42 Chap. 6...

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

View Full Document Right Arrow Icon
42 Chap. 6 General Trees Node 0123456789 1 0 1 1 1 2 1 3 1 4 1 5 Parent 4444 - 144004999 1 29 - 1 6.8 For eight nodes labeled 0 through 7, use the following series of equivalences: (0, 1) (2, 3) (4, 5) (6, 7) (4 6) (0, 2) (4 0) This requires checking fourteen parent pointers (two for each equivalence), but none are actually followed since these are all roots. It is possible to double the number of parent pointers checked by choosing direct children of rootsineachcase. 6.9 For the “lists of Children” representation, every node stores a data value and a pointer to its list of children. Further, every child (every node except the root) has a record associated with it containing an index and a pointer. Indicating the size of the data value as D , the size of a pointer as P and the size of an index as I , the overhead fraction is 3 P + I D +3 P + I . For the “Left Child/Right Sibling” representation, every node stores three
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 12/27/2011 for the course MAP 2302 taught by Professor Bell,d during the Fall '08 term at UNF.

Ask a homework question - tutors are online