Data structure picking legacy - linear table

zhaozj2021-02-16  51

Second-line table

This time, let's take a look at the linear table.

Let's give a linear knowledge map, which may not be very accurate, but you can help you recall most of your content you have learned in the data structure you have seen. In fact, before reading the following content, I also encourage you to stop thinking about thinking, thinking about the portions of those who still flash in memory in your memory.

I don't intend to debate the details of this picture, and I have not intended to discuss them all. Since it is "picking up", I will inspire you, I hope to make some problems that are easy to ignore, prompted you Better, more active to learn and think.

1. Data organization internal logic

A small ant, rushing on an undead beach. It has a tricky task, that is, it needs to examine all the sand on this sand. Wanli Pingda, I am gone, it is a thousand and different sand, which makes me start to investigate! The wind suggests it, centered at some point, to establish a "order" for all the sand: If the radius is R, the same is in this circumference, it is small, the outside is large, borrows R to Taking the sand, it will not start now.

If the sand can compare data, then build a order, which is to establish a model, which is the first step in our organization data, otherwise we have to face "Wanli Pingsha". In all orders, "linear" is the simplest one. The linear table we have talked today is basically a class of data structures based on this relationship.

For data set a = = = = = = =}, | A | = n, we map it as an = {A0, A1, ..., AN-1}, and for elements

Ai, 1 <= i <= n-2,

And it has a relationship with only AI-1, AI 1, the former calls it as a pre-drive, the latter says it is the only one. This is the basic logic characteristics of the linear table.

Abstract a sequence (or relationship) coming out, it is often a basic method for computer solutions. The development and evolution of the data structure is also from the perspective of data storage and organization, and demonstrates this idea.

We look at the linear table. The description can be illustrated. For basic parts, as shown below:

If you restrict access, it is a very wide range of data structures in our computer science:

When the linear table retrieves a data, it is generally sequentially searching until the data is searched. In other words, the time required for a retrieval or one update is linear. In order to solve this problem, it can be expanded into a probability-based data structure and jump table. For elements of linear tables, if it is also allowed to satisfy a certain structure, it can be expanded into a generalized table, and this data structure defines a good recursive. See below:

The constant concept behind the graphic indicates that they are changed by the same model. Abstract charm, far more than this. We have the opportunity to explain in the classic example of computer science. For strings and matrices, sparse matrices, some algorithms, it is worth noting.

For readers who are unfamiliar with these basic content, please check with the relevant data structure.

2. Places you should pay attention to when the linear table is realized

We will not talk about the implementation of linear forms in detail. When you implement, you are using C language, or use C languages, such as inserted nodes such as linked lists, you should pay attention to the order of pointers, such as linear tables, do you want to add a head node to a unified operation; They are not the focus, they are just the foundation, but I think this is what you must be familiar. (1) When it is realized, I want to summarize you, follow the knowledge structure of Figure 1, all of the linear forms of all common forms.

Realization of the list. In the form of a linked list, there is a division of a single-strand table, two-way linked list, b = {cycle, not loop}. Then, the front and rear combination, the category is: b × a, there are four kinds. Is it a tip that is a skill.

Stack and queue. Stacks and queues can be implemented in sequence tables, or you can be implemented. In addition, the cyclic queue is familiar with the priority queue. But what is interesting, a loop, everyone is rare; thinking about it, such as chess and other activities, only allow continuous return N, then save the active activities n step, you can do this. It is recommended that you will try it out.

Jumping tables and generalized forms. They can be found in the "Data Structure and Algorithm Analysis" (Zhang Mingshi) and "Data Structure (Description Use Object Method and C ) (Yin Kun, etc.).

(2) The meaning of the pointer is to store the address. Therefore, it is achieved, not only the pointer variables can be, but the integer variables can be used as a pointer. Therefore, the linked list, etc., can also be implemented in complex order storage.

(3) As shown below, an execution after a period of time:

For data structures such as C language or C language implementation, the memory resources are applied for memory resources. When memory resources are recycled, the problem comes out. Even after a careful design, there is no error; but because the node (a small memory unit) has multiple applications, it is necessary to recover when the recovery is recycled, and the speed will be particularly slow. If the number of nodes is huge, the speed is usually unbearable.

This problem is usually applied for a memory resource. When you apply for a larger unit, then use the cache area allocated by the node. After the use is completed, once again, apply for a larger unit. These larger cells are managed, and the recovery is no longer in units of nodes, while in units of units. Speed ​​can be improved.

(4) Do not use complex data structures only if necessary. Solving the problem is convenient.

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

New Post(0)