Algorithm--Basic knowledge

Source: Internet
Author: User
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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.