Data structure and algorithm
Basic part
1. Preamble
2. Linear table structure
-
array -
Linked list (one-way, two-way, cyclic) -
Special linear table: stack -
Special linear table: queue -
Programming Skills: Recursion
3. Sorting algorithm
-
Bubble sort -
Insert Sort -
Select Sort -
Merge sort -
Quick sort -
Analysis of the underlying implementation of PHP array sorting function sort
4. Search algorithm
-
Binary search -
Modified version of binary search (I) -
Transformed version of binary search (II) -
Analysis of binary search case: IP address corresponding city query -
Index lookup (I): dense index (database index technology basis) -
Index search (II): Block index (database index technology basis) -
Index search (III): inverted index (search engine technology basis)
5. Hash table
-
Hash Table Overview -
Hash function design and hash conflict handling -
Hash algorithm and its application (Security encryption, unique ID, data verification, hash function, load balancing, distributed cache) -
Basic implementation principle of PHP array (I): hash table structure and order implementation -
Basic implementation principle of PHP array (II): initialization, insertion, hash conflict handling, search, deletion
6. String matching
-
BF algorithm (The simplest and most violent matching algorithm) -
KMP algorithm (The most famous matching algorithm) -
Trie tree algorithm (Multi pattern matching algorithm, suitable for building sensitive word filtering system) -
Analysis of the underlying implementation algorithm of PHP string matching function strstr
Advanced part
7. Binary tree
-
The concept and characteristics of tree and binary tree -
Creation and storage of binary tree (array, linked list) -
Traversal of binary tree (pre order, middle order, post order) -
Definition and Implementation of Binary Sort (Search) Tree -
Ideal Binary Sort Tree: Definition and Implementation of Balanced Binary Tree (AVL Tree) -
Ideal Binary Sort Tree: Demonstration of the Construction Process of Balanced Binary Tree -
Rational binary sort tree: balance the implementation code and algorithm complexity of binary tree -
Engineering binary sort tree: definition and algorithm complexity of red black tree -
Engineering Binary Sort Tree: Analysis of Dynamic Balance Implementation Principle of Red Black Tree -
Application of Binary Tree (I): Heap and Heap Construction -
Application of Binary Tree (2): Heap Sort and Its Application (queue priority, TopK ranking) -
Application of Binary Tree (III): Huffman Tree and Its Construction -
Application of Binary Tree (IV): Simple Implementation of Huffman Coding and Compression Algorithm
8. Figure
Note: A graph is a master of data structure. Mastering a graph means mastering the data structure.
-
Various concepts of graph (undirected graph, directed graph, sparse graph, dense graph, connected graph, etc.) -
Storage of graphs (adjacency matrix, adjacency table) -
Graph Traversal (I) -- Depth First Search -
Graph Traversal (Part 2) -- Breadth First Search -
Definition and application scenarios of minimum spanning tree -
Prim algorithm of minimum spanning tree -
Kruskal algorithm for the implementation of minimum spanning tree -
Dijkstra algorithm of shortest path and implementation algorithm -
Floyd algorithm of shortest path and implementation algorithm -
Definition of topological sorting and its application scenarios (AOV network) -
Implementation algorithm and complexity analysis of topological sorting -
Definition of critical path and its application scenarios (AOE network) -
Critical path implementation algorithm and complexity analysis (Topological sorting solves the project feasibility problem, and the critical path solves the shortest project duration problem on this basis)
Application part
Data Structure
-
Queue implementation with two stacks -
Delete the linked list node at O (1) time -
Reorder arrays so odd numbers precede even numbers -
The k-th last node in the linked list -
Manually reverse linked list -
Merge two sorted linked lists -
Stack containing min function -
Push in and pop out sequence of stack -
Replication of complex linked lists
-
Replace space in string -
Arrangement and combination of strings -
The first character that appears only once
-
Rebuild Binary Tree (Pre order traversal, middle order traversal) -
Substructure of tree -
Image of binary tree -
Print binary tree from top to bottom (Traverse by layer) -
Post order traversal sequence of binary search tree (subsequent traversal) -
A path with a value in a binary tree (Preorder traversal) -
Conversion between Binary Search Tree and Double Linked List (middle order traversal) -
Depth of binary tree -
Judge whether a tree is a balanced binary tree
Common Algorithms
-
Sort the age of employees (Quick sort) -
A number that occurs more than half of the time in the array (Quick sort) -
Minimum number of k (Quick sort, heap sort, red black tree) -
Arranges the array elements into the smallest number (Quick sort, large number problem) -
Ugly number (space for time) -
Reverse pair in array (With the help of process statistics of merging and sorting)
-
Rotate the smallest number of the array (binary search) -
Number of occurrences of a number in the sorted array (Modified version of binary search)
Programming Skills
-
Recursive application: Fibonacci sequence -
Application of Fibonacci series: frog leaping step algorithm -
The integer power of a number -
Number of occurrences of 1 from 1 to integer n (Combine permutation and combination knowledge)
-
Print matrix clockwise -
Find in 2D array -
Print 1 to the maximum n digits -
Common node of two linked lists
-
Integer value corresponding to letter code column in Excel -
Number of 1 in binary integer -
Number that appears only once in the array
The above application code can be viewed on Github: https://github.com/nonfu/php_interviews