"Plain jane"? What that? This is inorder print:
p(Node subroot) {
if (subroot == null) return;
else {
p(subroot.left);
print(subroot.data);
p(subroot.right);
}
}
2007-11-24 20:26:25
·
answer #1
·
answered by Andy T 7
·
0⤊
0⤋
---Binary tree has left and right brances that point to other binary trees. Also holds a number varible and a string varible.
struct BTree {
BTreePOINTER Left
BTreePOINTER Right
string TextValue
int NumberValue
}
BTree Root; ---Root is the first node of a binary tree.
--ADD ITEMS TO TREE---
FOR I = 1 TO 100
AddToTree (Root, RandomText, RandomNumber)
NEXT I
---Call the Recurse function.
Recurse(Root)
---The recursive function.
FUNCTION Recurse(Node)
--Make sure the current node actually exists.
IF Node EQUAL NULL THEN
RETURN
END IF
---For each node print the two values.
Print (Node.TextValue)
Print (Node.NumberValue)
---Call the recurse function again from inside the recurse function on both the left and right branches. Now we're traversing the tree.
Recurse (Node.Left)
Recurse (Node.Right)
RETURN
END FUNCTION
That's the simplest way of thinking about it. A bit more complex if actually writing the code, but you said you wanted psuedo code.
2007-11-24 20:16:49
·
answer #2
·
answered by Anonymous
·
0⤊
0⤋
confident, as microprocessors are equipped employing transistors and good judgment gates that may purely in all threat artwork on binary (base 2), all bibles in digital format could be processed in binary, inspite of in spite of if or no longer they are encoded in ASCII, unicode, prolonged ASCII, or something.
2016-10-18 01:30:46
·
answer #3
·
answered by Erika 3
·
0⤊
0⤋