A Brief Introduction to Java Data Structures

1. Array

Concept: A linear collection of stored elements.

Array declaration and creation:

dataType[] arrayRefVar = new dataType[arraySize];

Two-dimensional array (multidimensional array) declaration and creation:

dataType[][] arrayName = new dataType[arraylenght1][arraylenght2];

PS: The length of the array must be determined.

2. List

Concept: A list is an ordered set of data.

Common implementations: ArrayList, LinkedList.

3. Stack

Concept: A stack is a last-in, first-out data structure.

Common implementation: Stack (java.util.Stack).

4. Queue

Concept: A queue is a first-in, first-out data structure.

Common implementation: LinkedList.

6. Linked list

Concept: A linked list is a collection consisting of a set of nodes. Each node uses an object reference to point to its successor. A reference to another node is called a chain.

List type:

1. Basic linked list

2. Doubly linked list (add an attribute to store a reference to the predecessor node)

3. Circular linked list (tail node points to head node)

7. Dictionary

Concept: A data structure stored in key-value pairs.

Common implementations: Dictionary, Map.

8. Hash

Concept: Hash table (also called hash table) is a data structure that is directly accessed according to the key value. It maps the key value to a location in the table to record data. This mapping function is called a hash function, and the array that stores the records is called a hash table.

9. tree

Concept: A tree consists of a set of nodes connected by edges, the root node has no parent node, and the child nodes are not connected.

Common trees: binary tree, binary search tree.

10. Figure

Concept: A graph is composed of a set of edges and a set of vertices. A graph is called a directed graph if its pairs of vertices are ordered, and an unordered graph if the graph is unordered. 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325101710&siteId=291194637