Java data structure tells you how to select data sets (1)

Disclaimer: This article is a blogger original article, follow the CC 4.0 BY-SA copyright agreement, reproduced, please attach the original source link and this statement.
This link: https://blog.csdn.net/ZackSock/article/details/100699112

Time to start learning to program, how to achieve the purpose of the function. After we are familiar with programming and found that the method implementation is varied. We operate a class, you can choose an array, List, Set even Map. But the specific implementation of it, you will find the situation complicated. And this time, implementation of diversity also allows us to do nothing. This time we need a data structure debut, learning data structure we can select the best implementation methods according to different situations. Of course, there are still some work to combine software engineering and design patterns to achieve.

Let's look at a few questions:

1. What is a data structure?

2, data structures, what's the use?

3. What specific performance data structures in Java is?

Here one to solve these problems.

1, the data structure is organized in some form of data collection together. Not only is the data structure to store data, also supports operations to access and process data. That data structure is: a set of processing operations organized data + data.

2, improved software performance , this will be learned in the back specific data structure.

3, in Java, a data structure is a container , or container object . (List, Set)

Here is the question, the linear form.

First, the concept of linear form:

Today to talk about specific linear table. Definition of the linear form I not go into here, there is little understanding of linear table is critical. It is one to one relationship between linear table element, an element that is linear table at most only a precursor element and a subsequent elements. Popular talk is "a front, a back."

Second, a linear table storage structure

1, the sequence storage structure: a set of contiguous addresses in the computer with the storage unit sequentially stores the respective linear table data element

2, Storage Structure: in a computer using an arbitrary set of the storage unit stores the linear form of data elements

The above two sentences may not have to explain too much content, but do not worry, the back will specifically.

Third, the order table

1, what is the order of the table: linear sequence table storage structure (ha, is one such)

2, the characteristics of the sequence table:

  ① period of continuous memory element is stored in which

  ② Find fast

  ③ insert data slow

3, Java ArrayList in the linear form

  In Java, ArrayList is a linear list. List structure is a linear list data structure, which defines the common attributes and operations linear table. When studying the collection, there are a lot of found List implementation class. Wherein ArrayList and LinkedList is very common and important two classes, they represent two linear table storage structure. ArrayList is sequential storage structure, and stores the chain structure is LinkedList.

4, written in Java a sequence table

  Because of space problems, later I will write another article about two or manually write the order form and list of articles. Here mainly about some of the content.

  ① linear list is implemented by an array

  ② When the length of the array to re-create an array is not enough (Java, arrays are a fixed length)

Fourth, the list

1, what is the list: linear table Storage Structure

2, the list of features:

  ① randomly stored in memory element

  ② Find low speed efficiency

  ③ insertion speed with high efficiency

3, in the list LinkedList Java: The above has been talked about, not repeat them here.

4, written in Java a sequence table

  ① list is implemented by a node

  ② data node and the node which has the address of the next node

In addition ArrayList and LinkedList, Java there are many other linear form. I have the opportunity and careful study. On the realization of linear form, it will be filled later in the article.

Guess you like

Origin blog.csdn.net/ZackSock/article/details/100699112