Data structure notes (i)

Source: Internet
Author: User

What is an algorithm (algorithm)

A description of the solution method (step) for a particular problem
Essence: A finite sequence of instructions in which each instruction represents one or more operations

algorithm Five features
    • There are poor steps, every step has poor time
    • deterministic directives must have a clear meaning and cannot exist ambiguity
    • The operation described by the feasibility algorithm must be implemented by the implementation of the basic operation of a finite number of times to achieve
    • Enter 0 or more inputs
    • outputs one or more outputs, with certain specific relationships to the input
Description Method
    • Natural language Description
    • Formal language description
    • Computer Programming Language Description
Algorithm Design Requirements
    • Correctness (correctness)
    • Readability (readability)
    • Robustness (robustness)
    • Versatility (generality)
    • Efficiency and storage requirements
Measurement of algorithm efficiency
    1. Pre-analysis to find the time limit function
    2. Post-mortem testing
/** * @Brief * bubblesort * @Param a[] * @Param N * *voidBubblesort (intA[],intN) {bool change=false;intI=0, j=0; for(i=n-1, change=true; I>1&& change; I.) for(j=0, change=false; j<i; ++J)if(a[j]>a[j+1]) {a[j]^=a[j+1]^=a[j]^=a[j+1];//Exchange two numbersChange=true; }}

Data structure notes (i)

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.