Algorithm--basic knowledge 1. What is an algorithm?
Answer: Algorithm (algorithm): A computational process, the method of solving the problem.
program = data structure + algorithm
2. Time complexity (tri-link graph)
Summary of Time complexity:
1. Time complexity is an equation (unit) used to estimate the run time of the algorithm.
2. In general, algorithms with high time complexity are slower than algorithms with low complexity
3. Common time complexity (sorted by efficiency)
-O (1) < O (logn) <o (n) < O (Nlogn) <o (N2) < (N2LOGN) <o (n3)
4. Uncommon time Complexity
O (n!) O (2n) o (NN)
5. How can I easily judge the complexity of time?
1. Find the n that represents the size of the problem
2. Is there a process of halving the cycle--"O (LOGN)
3. Several layers of loops are the complexity of several sides of n
3. Recursion
1. Two characteristics of recursion:
1. Call itself
2. End condition
Algorithm--Basic knowledge