Task1 + task4
Mandy
/ \
Ali John
\ / \
Emma peter Susan
/ \
Robert Tim
\
William
\
Tom
Task 2
50
/ \
25 74
/ \ \
17 35 80
\
90
Task 3
If the tree doesn't exist yet, make the DATA ITEM = ROOT NODE and finish.
Let CURRENT NODE = ROOT NODE.
Repeat until CURRENT NODE is null.
If DATA ITEM is less than CURRENT NODE, go to the left.
Else go to the right.
CURRENT NODE = value of node reached so far. (Node reached so far = null if there is no node at that position).
Create new node and add DATA ITEM to that position.
Monday, 19 November 2007
Binary Trees
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment