class documentation
Abstract base class representing a tree structure.
| Class | |
An abstraction representing the location of a single element within a tree. |
| Method | __iter__ |
Generate an iteration of the tree's elements. |
| Method | __len__ |
Return the total number of elements in the tree. |
| Method | breadthfirst |
Generate a breadth-first iteration of the positions of the tree. |
| Method | children |
Generate an iteration of Positions representing p's children. |
| Method | depth |
Return the number of levels separating Position p from the root. |
| Method | height |
Return the height of the subtree rooted at Position p. |
| Method | is |
Return True if the tree is empty. |
| Method | is |
Return True if Position p does not have any children. |
| Method | is |
Return True if Position p represents the root of the tree. |
| Method | num |
Return the number of children that Position p has. |
| Method | parent |
Return Position representing p's parent (or None if p is root). |
| Method | positions |
Generate an iteration of the tree's positions. |
| Method | postorder |
Generate a postorder iteration of positions in the tree. |
| Method | preorder |
Generate a preorder iteration of positions in the tree. |
| Method | root |
Return Position representing the tree's root (or None if empty). |
| Method | _height |
Return the height of the tree. |
| Method | _height |
Return the height of the subtree rooted at Position p. |
| Method | _subtree |
Generate a postorder iteration of positions in subtree rooted at p. |
| Method | _subtree |
Generate a preorder iteration of positions in subtree rooted at p. |
overridden in
dsap.searchtree.binary_search_tree.TreeMapGenerate an iteration of the tree's elements.
overridden in
dsap.trees.linked_binary_tree.LinkedBinaryTreeReturn the total number of elements in the tree.
overridden in
dsap.trees.binary_tree.BinaryTreeGenerate an iteration of Positions representing p's children.
Return the height of the subtree rooted at Position p.
If p is None, return the height of the entire tree.
overridden in
dsap.trees.linked_binary_tree.LinkedBinaryTreeReturn the number of children that Position p has.
overridden in
dsap.trees.linked_binary_tree.LinkedBinaryTreeReturn Position representing p's parent (or None if p is root).
overridden in
dsap.trees.linked_binary_tree.LinkedBinaryTreeReturn Position representing the tree's root (or None if empty).