data_structures.binary_tree.basic_binary_tree¶
Classes¶
Module Contents¶
- class data_structures.binary_tree.basic_binary_tree.BinaryTree¶
- __iter__() collections.abc.Iterator[int]¶
 - __len__() int¶
 - depth() int¶
- Returns the depth of the tree - >>> BinaryTree(Node(1)).depth() 1 >>> BinaryTree.small_tree().depth() 2 >>> BinaryTree.medium_tree().depth() 4 
 - is_full() bool¶
- Returns True if the tree is full - >>> BinaryTree(Node(1)).is_full() True >>> BinaryTree.small_tree().is_full() True >>> BinaryTree.medium_tree().is_full() False 
 - classmethod medium_tree() BinaryTree¶
- Return a medium binary tree with 3 nodes. >>> binary_tree = BinaryTree.medium_tree() >>> len(binary_tree) 7 >>> list(binary_tree) [1, 2, 3, 4, 5, 6, 7] 
 - classmethod small_tree() BinaryTree¶
- Return a small binary tree with 3 nodes. >>> binary_tree = BinaryTree.small_tree() >>> len(binary_tree) 3 >>> list(binary_tree) [1, 2, 3]