1 / 41 Settings
<<<>>>

Preorder traversals start by processing the root node.

Created with Raphaël 2.1.2
  • // Preorder traversal for general trees
  • static void preorder(GTNode rt) {
  • PrintNode(rt);
  • if (!rt.isLeaf()) {
  • GTNode temp = rt.leftmostChild();
  • while (temp != null) {
  • preorder(temp);
  • temp = temp.rightSibling();
  • }
  • }
  • }
Created with Raphaël 2.1.2
R
A
B
C
D
E
F
rt
Proficient Saving... Error Saving
Server Error
Resubmit