- This is a data structure composed of Nodes.
- Included methods are:
- insert
- contains
- size
- depth
- balance
- Various methods for traversing the graphs
1. in_order(self): will return the values in the tree using in-order traversal, one at a time.
2. pre_order(self): will return the values in the tree using pre-order traversal, one at a time.
3.post_order(self): will return the values in the tree using post_order traversal, one at a time.
4. breadth_first(self): will return the values in the tree using breadth-first traversal, one at a time.
Helpful Resource to better understand how to implement the breadth first traversal: (http://stackoverflow.com/questions/1894846/printing-bfs-binary-tree-in-level-order-with-specific-formatting)
- Remove value from the tree if present, if not present this method is a no-op. Return None in all cases
- Balance the tree upon the insertion or the deletion of a node. This allows for the Binary Search Tree to be as optimal as possible.
- This structure hashes keys and stores the value. Essentialy we created what Python's dictionary does. It lets the user set the number of buckets to store words and then hashes the keys and stores them at the correct index of the list of lists.
- get - returns the value of a given key
- set - sets a key value pair
#Trie
- This structure is used specifically for lexicon completion situations such as autocomplete.
- insert: Insert a token into the Trie
- Contains: See if a token has been entered into the Trie