Binary Tree
A binary tree is a tree in which no node can have more than two children.
The depth of an average binary tree is considerably smaller than N.
For binary search tree, the average depth is O(logN)
Difference between BT and BST:http://stackoverflow.com/questions/6380231/difference-between-binary-tree-and-binary-search-tree
Binary Tree Implementation
http://blog.csdn.net/b_end_an/article/details/9975943
Binary Search Tree
For BST questions, we need to clarify if we allow duplicate!
http://stackoverflow.com/questions/300935/definition-of-a-binary-search-tree
Tree Traversal
http://en.wikipedia.org/wiki/Tree_traversal#Depth-first
Different way to implement tree traversal: http://blog.csdn.net/kofsky/article/details/2886453
Iterative post-order traverse tree: http://leetcode.com/2010/10/binary-tree-post-order-traversal.html
- Visit the root.
- Traverse the left subtree.
- Traverse the right subtree.
- Traverse the left subtree.
- Visit the root.
- Traverse the right subtree.
- Traverse the left subtree.
- Traverse the right subtree.
- Visit the root.
- Traverse each node on a level
- Go to the next level
Trie
http://en.wikipedia.org/wiki/Trie
In computer science, a trie, also called digital tree or sometimes radix tree or prefix tree (because we can search by prefixes), is anordered tree data structure that is used to store a dynamic set or associative array where the keys are usually strings. Unlike a binary search tree, no node in the tree stores the key associated with that node; instead, its position in the tree defines the key with which it is associated. All the descendants of a node have a common prefix of the string associated with that node, and the root is associated with the empty string. Values are normally not associated with every node, only with leaves and some inner nodes that correspond to keys of interest.
Each node can have 0 ~ 26 children.
Trie Implementation
http://blog.csdn.net/b_end_an/article/details/10012155
Graph
Graph Definition: http://blog.csdn.net/b_end_an/article/details/8943169
Graph representation
1. adjacency matrix
2. adjacency list