Programmer account notes (15)

xiaoxiao2021-03-06  104

Today, I have been looking for a chapter of the hall, and I have already discovered the order look for and two points. These two are often used. Another is a special lookup method is a hash table (herein, this lookup method is several different names, mixture and hash table). Because this may talk for a lot of time, the teacher has no detailed explanation, just got a relatively thought, as follows:

Ri Keyi

a (0) = 20

a (1) = 30

a (2) = 40

A (3) = 50 addr (ri) = h (keYi)

Ri = keyi / 10-2 this relationship

That's it, it is certainly different relationships for different problems, just just know that this thought is fine. The search in the tutorial is these three kinds, and now I started sorting. Sorting relative lookups, many ways, we have also touched several ways to sort, it is the first chapter of the binary tree sorting, and the bubbles who have been speaking very early, I think many people You should know this classic sort. Now, it is to insert the ordering method. The advantage of this method is that the node has been inserted into a new node. There is a sequential that can be used in the chapter of the previous chapter. Inserted position. In fact, give a row of arrays, you can divide it into two major parts, one is the node of the already row, and the other part is the node to be inserted, so that this algorithm can be simulated. Take a look at the fifteenth day, you can clearly see how the entire idea is. Below we have to use the C language to describe this sorting algorithm, a total of a total of a variety of versions, everyone is a contrast to see who is efficient. INT A [10] = {8, 7, 10, 30, 5, 1, 7, 10, 0, 25}; INT I, J, K; For (i = 1; i = 0 && t

another

For (i = 1; i <= 9; i ) for (j = 0; j <= i-1; j ) {IF (a [j]> a [i]) {t = a [j]; a [j] = a [i]; a [i] = t;}}

Another another

For (i = 1; i = 0; j -) IF (k> a [j]) Break; Else A [J 1] = a [J]; A [J 1] = K;}

In the past three programs, please analyze it yourself, you must have to move your mind. Ok, the problem is finally finally coming out, it is to change this algorithm to a chain form. Do you think of it? We all rushed to try it, but in the end, we didn't make it for normal situations, all we didn't make it. Let's take a look at the program written by the teacher:

Some of the first definitions, slightly p = h-> next; h-> next = null; while (p) {if (p-> data data) {= p-> next; p-> next = H; h = p; p =} else {q = h; r = q-> next; while (r && p-> data> r-> data) {q = r; r = r-> Next } Q-> next = P; p = p-> next; q-> next-> next = r;}} I am somewhat lost today, it may be because of doing questions, anyway, I don't know how But I will still stick to it, I will continue to work hard, I hope everyone can work with me!

转载请注明原文地址:https://www.9cbs.com/read-124122.html

New Post(0)