Discrete summary

Discretization is a very common data processing.

 

Recently also learn a bit ( I still have it saved scholarship QAQ ), a study to understand, but found in the title does not seem to think of how this thing ,, so here I briefly summarize some discrete thinking and summary it. . . .

 

Online excerpt の concepts: discrete, finite to the infinite space is mapped to the individual to limited space, time and space in order to improve the efficiency of the algorithm.

 

A. Discrete implementations and nature

 

First, the concept is mentioned, discrete is the infinite space is limited to individual maps to limited space.

Abstract problems into code, so you can usually represent: a disorderly array a, all the elements of a discrete.

 

Implementation:

Create an array B, a copy down the array, like a sort deduplication +. . .

 

Obviously: the relative magnitude between the values ​​of the array elements b and a each element of the array is the same.

 

In this way, we can carry out a mapping operation between the conventional elements of an array with a value between the array and the subscript b:

1.a or element array index value -> b subscript array: binary search.

2.b array subscript -> a array of values: apparent.

In some cases, we also need an array subscript b -> a target array mapping. Then we need to b is defined as an array type structure, comprising two (or more, simply because there is not necessarily b array element of the array a) Members: sum (represented by element value), index (represented by the original array standard), redefine the comparison function when sorting line.

 

II. Discretized use

 

The concept was mentioned, a reasonable application of discrete can improve the time and space efficiency of the algorithm.

1. Space efficiency improvement: Obviously. . For example, gives you a number of large wavelet, let you perform some operation for each number, you have to save up the results of the operation, it is clear that use discrete thing. . . .

2. Time efficiency improvement: a problem to be solved, if it answers only related to certain elements on a sparse set of discrete also be considered, it might be able to greatly enhance the time complexity of the algorithm. . . (Tm pure yy of my own right .. not ...)

 

 

So be it. . . Really it is not what to write low level of deeper things. . .

Writing is really no logical ,, with the same lump of feces. . . .

Guess you like

Origin www.cnblogs.com/ABBEJ/p/11267526.html