[Big liar data structure] algorithm

Source: Internet
Author: User

Algorithm Related:

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

It is not possible to implement all the algorithms, and it is more impossible to use all the input verification algorithm, so the correctness of the algorithm in most cases can not be proved by the program, but the mathematical method to prove.

Good algorithms should have the characteristics of correctness, readability, robustness, high efficiency and low storage capacity, but the research that is meaningful to the algorithm is the efficiency of the algorithm.

The method of measuring the efficiency of the algorithm:

Post-mortem method: This method is mainly through the design of good test procedures and data, the use of computer timers to different algorithms programmed by the running time comparison, so as to determine the efficiency of the algorithm execution. However, the shortcomings of this method are obvious, mainly must follow the algorithm in advance programmed to achieve, the time of the statistical dependence on the computer hardware and software environment, the algorithm test data design difficulties.

Pre-analysis and estimation methods:

This method considers the running time of a program as dependent on both the quality of the algorithm and the input scale of the problem. So the question comes, what is the input scale of the problem? How is the input scale measured?

Let's start by pointing out an obvious fact: almost all algorithms require more time to run for larger inputs. Therefore, it is very logical to use the algorithm efficiency T as a function to input the size n as a parameter when studying the efficiency of the algorithm.

In fact, the most reliable way to measure uptime is to calculate the number of executions of the basic operations that are consumed during the run time. The number of basic operations associated with the input scale, that is, the number of basic operations must be represented as input-scale functions.

The actual operation number of the algorithm in the table is the number of basic operations of the algorithm

The time complexity of the algorithm:

At the time of the algorithm analysis, the total number of executions of the statement (Basic operation), T (n), is a function of the problem size n, which analyzes the change of T (n) with N and determines the order of magnitude of T (N).

The usual time complexity is consumed from small to large, in turn:

The worst-case scenario for the algorithm's uptime is a guarantee of run time, which is that the run time will not be broken anymore. In the application, this is one of the most important requirements, usually, unless specifically specified, the runtime that we refer to is the worst-case run time.

The average run time is the most meaningful in all cases because it is the desired run time.

Summarize:

As a data structure of the notes, the discussion of the algorithm first said these. The following immediately into the data structure of the real learning.

[Big liar data structure] algorithm

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.