[Turn] algorithm and data structure--Introduction summary and self-study material recommendation
This article turns from (http://www.cnblogs.com/jiahuix/p/4868881.html)
First, the outline
Blog : Dong Xi , Vamei
Mind Mapping: http://pan.baidu.com/s/1gdCqW8r
Second, data structure data recommendation
Array : Find Fast O (1), insert delete slow o (n)
linked list : Find slow o (n), insert delete quick O (1)
block Linked list : Find insert Delete O (sqrt (n)); array + linked list;
Queue : FIFO
Stack : Advanced back out
dual-ended queues : The queue and Stack, with the head and tail Array, the first team tail can be added and deleted.
Hash Table :
- Collection A to the collection B the mapping;
- hash Function: MD5, SHA ;
- Application: File comparison, password storage;
- Collision Resolution: Open Hashing linked list; Closed hashing The array subscript moves to the empty space ( rehashing move to a larger new array) Hash Table
Bit-map : A bit represents a number, such as 10bit can represent 1~10 bitmap
Two fork Pile / Heap : Height is (lg^2) n, array data 2
Minimum heap: Each parent node is smaller than the child node
Dictionary Tree (prefix tree): Suitable for string retrieval, longest string public prefix, sort data by dictionary
Insert, find O (n): N is a string length, space O (26^n)
suffix tree : Suitable for complex string manipulation
suffix Tree Group : Suitable for complex string manipulation
two fork Find tree : The complexity of the additions and deletions is equal to the depth, the depth is n, the minimum is log (n)
The order of the sequence will degenerate into a linear table, the time of only one.
If the delete node has both left and right nodes at the time of deletion, replace it with the maximum value of the left subtree of the delete node or the minimum value of the child tree.
B - tree : Performance is always equal to two, there is no balance problem.
B + tree : Suitable for file indexing system, only hit on leaf node.
b* Tree : Increase the space utilization by increasing the sibling pointer on the B + tree basis
AVL : Balanced binary tree, depth of O (LGN), sub-tree depth difference not exceeding 1, single rotation and double rotation data
Minimum Depth Math.ceil (log (2) (n+1))
treap : Heap tree, performance is between ordinary binary tree and AVL
red and black trees : Statistical performance than AVL good data
splay Tree : Stretching the tree, each search will be rotated once, the search frequency of the nodes will be rotated to the root node. m - time Search complexity O (MLGN)
Segment Tree : Efficiently asking and modifying information about a range in a series
tree-like array : Tree arrays convert linear structures to pseudo-tree structures (linear structures can only scan elements individually, while tree-like structures allow for jumping scans), making the modification and summation complexity both O (LGN)
Figure : Representation of graphs: two-dimensional arrays, adjacency tables
and check Set : It is often used as a storage structure for another complex data structure or algorithm. Common applications are: the number of connected components for undirected graphs, the recent public ancestor (LCA), the job sequencing with restrictions, the implementation of the Kruskar algorithm to find the minimum spanning tree.
Third, the algorithm data recommendation
Basic thought: dynamic programming , pruning , backtracking method
Sort by: Quick Sort , merge sort , heap sort , bucket sort , seven sort comparison
string: KMP,KMP,KMP
Number theory: permutations and combinations
Tree:
Traverse : Each node is checked for
First Order traversal: top, left, and right
Middle sequence traversal: Left, top, right
Post-post traversal: Left, right, top
Depth-First search DFS through the stack to achieve
Breadth First Search BFS through the queue to achieve
* images from the Web ~>_<~
[Turn] algorithm and data structure--Introduction summary and self-study material recommendation