Data Structure beginner 0 (Introduction)

Source: Internet
Author: User

EfficientProgram= Proper data structure + appropriateAlgorithm

I. algorithm features
1. Input
The algorithm has zero or multiple inputs.
2. Output
The algorithm must have at least one or more outputs.
3. Poor
An algorithm automatically ends after a limited number of steps without infinite loops.
4. Certainty
Each step in an algorithm has a definite meaning, so there is no ambiguity or ambiguity.
5. Feasibility
Every step of the algorithm is feasible.

Ii. Algorithm Design Principles
1. correctness
The algorithm can obtain results that meet the requirements for valid data.
The algorithm can process illegal input, obtain reasonable results, and obtain reasonable results.
The algorithm can meet the requirements for the boundary data and pressure data.
Note:
Correctness is the basic criterion that the algorithm needs to satisfy.
In computer programs, it is impossible to satisfy this criterion without limitation.

2. Readability
Algorithms should be easy to read, understand, and communicate.
3. robustness
Algorithms should not produce inexplicable results
4. High Cost Effectiveness
Use the minimum time and resources to get results that meet the requirements

Iii. Summary

1. algorithms are designed to solve practical problems.
2. Data structure is the carrier of issues to be addressed by Algorithms
3. data structures and algorithms complement each other

Program = Data Structure + Algorithm

Iv. algorithm efficiency measurement
1. post-event statistics
Compare the running time of different algorithms for the same group of input data
Defects:
In order to obtain the running time of different algorithms, it is quite difficult to compile the corresponding program running time, which is heavily dependent on the hardware and the testing data of the runtime environment factor algorithm.
Although the post-event statistics method is intuitive, it is difficult to implement and has many defects, but it is difficult to implement and has many defects.

2. Pre-ANALYSIS AND ESTIMATION
Estimation of algorithm efficiency based on statistical methods
Algorithm policies and methods
Problem input Scale
TheCode
Computer execution speed

3. When determining the efficiency of an algorithm, you often only need to pay attention to the maximum number of operations. Other secondary and constant items can be ignored.

Other secondary and constant items can be ignored.

1. The space complexity of the algorithm is achieved through the storage space of the computing algorithm

S (n) = O (f (n ))
Where, n is the problem scale, F (n )) a function that occupies the storage space when the problem scale is N.
Large O representation is also applicable to the spatial complexity of algorithms.
When the space required for Algorithm Execution is a constant, the space complexity is O (1)

2. In most cases, the time used for Algorithm Execution is more important. If necessary, you can reduce the time complexity by increasing the space complexity.
Similarly, we can increase the time complexity to reduce the space complexity. When implementing the algorithm, we need to analyze the requirements of specific problems on the execution time and space.

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.