First, I would like to thank everyone for the help they have given me while
working my assignments. It has been extremely helpful, I got both programs
working with minor nuances, but as I get better and learn more about this
language i'm sure it will come more naturally to me.
Now i'm dealing with trees.
I understand how browse the tree, but I'm not sure how to traverse the tree
properly...
Given this binary tree as a record,
T=tree(info:10
left:tree(info:7
left:nil
right:tree(info:9
left:nil
right:nil))
right:tree(info:18
left:tree(info:14
left:nil
right:nil)
right:nil))
{I can browse to all the values {Browse T.left.info} etc...
So I wrote this, which the machine accepts.
fun {Order X}
if X.left == nil then nil
else X.info|{Order X.left}
if X.right == nil then nil
else X.info|{Order X.right}
end
end
end
I wanted to Check to see if the left of the tree is nil, if yes, then I
wanted to check the right side of the tree, to see if that was nil. If it
isn't nil, then I wanted to take the value in that position and place it in
a list and then browse the rest of the tree to the left and the the right.
I know the code doesn't work, but can someone point me in the right
direction and explain how to actually browse the tree without giving me
code? I'll learn more if I do it with guidance instead of having the code
given to me.
Thank you all again for the help so far....
--
Kurt Breitsprecher
(807) 474-9601
[email protected]
_________________________________________________________________________________
mozart-users mailing list
[email protected]
http://www.mozart-oz.org/mailman/listinfo/mozart-users