Foundation of algorithm design and analysis chapt 2 algorithm efficiency analysis

Source: Internet
Author: User
ArticleDirectory
    • 2.1 Analysis Framework
    • 2.2 progressive symbols and basic efficiency types
    • 2.3 Mathematical Analysis of Non-Recursive Algorithms
    • 2.4 Mathematical Analysis of Recursive Algorithms
2.1 Analysis Framework 2.1.1 input scale measurement
    • In most cases, n is input.
    • Matrix, dimension
    • ValueAlgorithm, Number of BITs
2.1.2 measurement unit of running time
    1. Find out the most important operation in the algorithm, that isBasic operations
    2. Calculate the number of times they run
2.1.3 increase times

Logn n nlogn N2 N3 2n n!

2.1.4 optimal, worst, and average efficiency of Algorithms
    • Optimal efficiency
    • Worst Efficiency
    • Average Efficiency
    • Amortization Efficiency
2.2 Introduction to progressive symbols and basic efficiency types 2.2.1 Primary, Ω, primary

Bytes(G (N) is a set of functions that increase the number of times less than or equal to G (n ).

Ω(G (N) is a set of functions that increase more than or equal to G (n ).

 

Bytes(G (N) is a set of functions that increase the number of times to G (n ).

2.2.2 symbol Bytes 2.2.5 useful features of progressive symbols

2.2.6 increase by limit

The first two cases:

The last two cases:

Case 2:

2.2.7 basic efficiency types 2.3 Mathematical Analysis of Non-Recursive Algorithms

A general solution for analyzing the efficiency of non-recursive algorithms:

    1. Determines which (some) parameter is used as the input scale measurement.
    2. Find out the basic operation of the algorithm (as a rule, it is always located in the innermost loop of the algorithm)
    3. Check whether the number of basic operations depends on the input size. For example, if it depends on other features, such as the input sequence, the worst efficiency, average efficiency, and optimal efficiency need to be studied separately.
    4. Creates a sum expression for the number of times an algorithm performs basic operations.
    5. Use the standard formulas and rules of the sum operation to establish a closed formula for the number of operations, or at least determine the number of increases.

Two basic rules for sum calculation:

Two common summation formulas:

2.4 Mathematical Analysis of Recursive Algorithms

UseRecurrenceNumber of basic operations

    1. Determines which parameters are used as the input scale measurement.
    2. Basic algorithm operations
    3. Check whether the number of basic operations varies with input of the same scale. If they are different, the worst efficiency, average efficiency, and optimal efficiency must be studied separately.
    4. Establishes a recursive relationship and corresponding initial conditions for the number of executions of basic algorithm operations.
    5. Solve this recursive formula, or at least determine the number of times the solution increases.

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.