Basic concepts of algorithms

Source: Internet
Author: User

The algorithm refers to the accurate and complete description of the solution to the problem. is a set of rules that rigorously define the order of operations, and each rule is valid and unambiguous, without ambiguity, and the rule will be terminated after a finite number of operations.
1) basic features of the algorithm
(1) Feasibility: Because the design of the algorithm is designed to solve a certain practical problem on a particular computing tool.
(2) Certainty: The design of the algorithm must be a clear definition of each step, do not allow a vague interpretation, there can be no ambiguity.
(3) There is poor sex: The algorithm is poor, that is, in a certain time is able to complete, that the algorithm should be calculated after a limited number of steps to the normal end.
(4) have enough intelligence: the execution of the algorithm is related to the input data and the provided initial conditions, different input or initial conditions will have different output results, provide accurate initial conditions and data, in order to make the algorithm correctly executed.
2) Basic elements of the algorithm
One is the operation and manipulation of the data object, and the other is the control structure of the algorithm.
(1) Calculation and operation of data in the algorithm
The algorithm is actually a set of sequences of instructions that are composed of the appropriate actions to be chosen from all the operations that the environment can perform in order to solve the problem. That is, an algorithm is a sequence of instructions that a computer can manipulate.
(2) control structure of the algorithm
In the algorithm, the execution order of the operation is called the control structure of the algorithm, the general algorithm control structure has three kinds: the sequential structure, the choice structure and the cyclic structure.
3) Basic method of algorithm design
(1) enumeration: The basic idea is to enumerate all possible situations according to the questions raised, and to test which conditions are satisfied and which are not satisfied by the condition given in the question.
(2) Inductive method: The basic idea is, by enumerating a small number of special cases, after analysis, finally find out the general relationship.
(3) Recursion: Starting from the known initial conditions, each successive introduction of the required intermediate and final results. Nature is also a kind of induction, recursive relationship is usually the result of induction.
(4) Recursion: in solving some complex problems, in order to reduce the complexity of the problem of the program, usually the problem is divided into layers, and finally boils down to some of the simplest problems. It is divided into two methods: direct recursion and indirect recursion.
(5) Halve recursion technology: Halve the size of the problem by half, and then repeat the same recursive action.
(6) Backtracking: Some practical problems can not be summed up a simple set of recursive formulas or intuitive solution steps, nor can you use infinite enumeration.

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.