Basic concepts of algorithms

Source: Internet
Author: User

Algorithm:

is a description of the solution steps for a particular problem that behaves as a finite sequence of instructions in the computer, and each instruction represents one or more operations.

Features of the algorithm:

(1) Input and output

The algorithm has 0 or more inputs

The algorithm has at least one or more outputs

(2) Poor sex

The algorithm automatically ends without an infinite loop after performing a limited number of steps, and each step is completed within an acceptable time.

(3) Certainty

Each step of the algorithm has a definite meaning, and there is no ambiguity of two.

(4) Feasibility

Each step of the algorithm must be feasible, that is, each step can be completed with a finite number of executions.

Requirements for algorithmic design:

(1) Correctness

The correctness of the algorithm is that the algorithm should have no ambiguity in input, output and processing, can correctly reflect the problem, and can get the correct answer to the problem.

(2) Readability

Another purpose of algorithm design is to facilitate reading, understanding and communication.

(3) Robustness

When the input data is not valid, the algorithm can also make the relevant processing, rather than produce abnormal or strange and strange results.

(4) High time efficiency and low storage capacity

The method of measuring the efficiency of the algorithm:

(1) Afterwards statistical method: (unscientific, inaccurate)

This method is mainly through the design of good test procedures and data, the use of computer timers on the programming of different algorithms to compare the running time, so as to determine the efficiency of the algorithm.

(2) Pre-analysis and estimation methods

Before the computer program is compiled, the algorithm is estimated according to the statistical method.

Note: The run time of a program depends on the quality of the algorithm and the input scale of the problem. Ultimately, the most important thing to do when analyzing the running time of a program is to think of it as an algorithm or a series of steps that are independent of the programming language.

Complexity of Time:

Program approximate number of executions (not execution time)

Note:

Time complexity is divided into: The best time complexity, the average time complexity, the worst time complexity

When there is no special description, it refers to the worst time complexity.

Complexity of space:

The storage space that is opened up for an algorithm to be implemented.

Basic concepts of algorithms

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.