Task5 Traverse the tree until you find the item that you want to delete.
Call that item the root node.
Copy all of the items underneath the root node to another data structure, perhaps using a stack, for example.
Delete the root node.
Use the insertion algorithm to re-enter each data item in turn from the stack into the tree.
Task 6 Mandy
/ \
Ali John
\ / \
Emma peter Susan
/ \
Robert Tim
\
William
\
Tom
Robert
Tim
William
Tom
Mandy
/ \
Ali John
\ / \
Emma peter Robert
/ \
Tim William
/
Tom
Task7
50
/ \
25 74
/ \ \
17 35 80
\
90
50
/ \
25 74
/ \ \
17 35 80
Task8
Let TERMINAL NODE = ROOT NODE
If ROOT NODE = DATA ITEM
Then end
Else Transverse Until ROOT NODE = DATA ITEM
Monday, 19 November 2007
Binary Trees
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment