Tree
General Definition of Trees A tree consists of a set of nodes and a set of edges that connect pairs of nodes. A tree is either empty or consists of a root and zero or more subtrees, each of which is also a tree. # Binary Tree Illustration class Tree: def __init__(self, value): self.key = value self.left = None self.right = None Tree Traversals Preorder Visit the root node first, then recursively do a preorder traversal of the left subtree, followed by a recursive preorder traversal of the right subtree. »