2c03-review - 00003

2c03-review - 00003 - 5.[13] a.[10] type Tree = record...

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

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: 5.[13] a.[10] type Tree = record labels: array[1..max] of labeltype; n: 1..max; end; procedure Preorder(T: Tree) begin PrintPre(T, 1) end procedure PrintPre(T:Tree, m:1..max) begin if m>T.n then return; write(T.lables[m]); PrintPre(T, 2*m); PrintPre(T, 2*m+1) end b.[3] O(n). Since every node is visited only one time. 6.[10] The complete tree with 9 nodes is in this shape: a b d h ij e f c g The preorder is a, b, d, h, i, e, j, c, f, g 1, 2, 3, 4, 5,6, 7,8, 9, 10 So, the tree should be as, 1 2 3 4 57 6 9 8 10 3 ...
View Full Document

Ask a homework question - tutors are online