Data Structure Review 1:

Disclaimer: This article is a blogger original article, shall not be reproduced without the bloggers allowed. https://blog.csdn.net/qq_38446366/article/details/89394805

Recently began to return to theoretical knowledge, a good review of the content learned before, summarized the article and, from time to time review. Keep going!

##1. Basics of data structures:

The basic concept data structure ###:

Study the relationship between data elements (array / list / tree / FIG).

        Data: Operating target program, used to describe objective things.

        Data elements: the basic units of the data.

        Data objects: a set of data elements of the same nature.

For example: int a, int b ..... ab represents data; int array [10], a data object; array [0] array [1] ... are data elements (a node),

Logic ### of the data structure:

Four Relations:

       Collection: there is no relationship between data elements

       Linear structure: between data elements is a one to one relationship such as linked lists, queues

       Tree: the data element is a one to many relationship like a tree

       FIG structure: many to many relationship between the data elements in FIG.

Physical Data Structure ###:

Storage structure, also known as physical structure, is the logical structure data representation (or image) in the computer memory, the computer dependent.

       Storage structure can be divided into four categories: the order list, index, hash (md5, sha1, sha256, sha512, SM series),

### data operations:

Insert, delete, modify, search, sort.

## 2 algorithm:

### algorithm concept:

Algorithm is important that the idea of ​​the algorithm is a step problem solving.

### Algorithms and Data Structures difference:

Only static data structure describing the relationship between data elements. Algorithms + Data Structures = Programs

### algorithm features:

Input, output, finite, certainty and feasibility.

### algorithm efficiency metrics:

Settlement prior analysis, to estimate the efficiency of the algorithm based on statistical methods.

The main factors that affect the efficiency of the algorithm:

       Strategies and methods used by the algorithm, the execution speed of the input size, the compiler issues arising from the code, the computer.

The step number of the program, the complexity of the algorithm is determined. -------> Big O notation

Time complexity and space under the worst case complexity.

####time complexity

Role: time complexity is a measure of the length of the execution time of the algorithm; (time complexity simply means that the number of execution of the statement and if there is a recursive loop is ignored simple statements, direct count the number of execution cycles and recursive statements.)

With a large time complexity O progressive notation

Time computational complexity:

1, to find out the number of executed statements. If the circulation and recursive, simple statements is ignored, and the direct execution cycle count recursion statement; if there comprises nested loop algorithm is performed is generally multiply two times the number of cycles, if the algorithm is included in parallel cycle, and then adding;

2, the number of executions of statement-level into a large Ο notation;

    Substituted adder by a constant in the constant running time;
    the number of runs in the modified function, leaving only the highest order term;
    If the highest coefficient exists and is not 1, then the removal of the constant term is multiplied;

#### space complexity

Action: Spatial complexity is a measure of the size of storage space required algorithm (space complexity of calculation is not actually occupied space, but the algorithm calculates the number of auxiliary space units) denoted S (n) = O ( f (n)).
Simple to understand variables (including temporary variables) is created when the number of algorithm execution

① ignoring constants, when given O (1)
space ② recursive algorithm complexity of the recursion depth = N * each recursion desired auxiliary space
③ For single-threaded, the runtime stack with a recursive, recursive seeking the deepest that time the number of push-consuming space, because the space that it takes a recursive enough to accommodate all its deepest recursive process. Recursion is to return to the previous level, so the space it needs not always add up.

 

 

Guess you like

Origin blog.csdn.net/qq_38446366/article/details/89394805