Java data--linked list

Source: Internet
Author: User

Linked list
A linked list is a non-sequential, non-sequential storage structure on a physical storage unit, and the logical order of the data elements is achieved through the order of the pointers in the linked list. A linked list consists of a series of nodes (each element in the list is called a node) that can be dynamically generated at run time. Each node consists of two parts: one is the data field that stores the data element, and the other is the pointer field that stores the next node address. The operation is complex compared to the linear table order structure. Since they do not have to be stored sequentially, the list can achieve an O (1) complexity at the time of insertion, much faster than another linear table-order table, but the time to find a node or to access a particular numbered node requires O (n), while the corresponding time complexity of the linear and sequential tables is O (Logn) and O (1) respectively. Using the list structure can overcome the shortcoming that the array list needs to know the data size beforehand, the list structure can make full use of the computer memory space and realize the flexible memory dynamic management. However, the list loses the advantage of random array reading, and the spatial overhead of the linked list is larger due to the increase of the point-of-view pointer domain. The most obvious benefit of a linked list is that the regular array arranges the associated items in a different way than the data items are in the order of memory or disk, and the data accesses tend to be converted in different permutations. Lists allow you to insert and remove nodes from any location on the table, but do not allow random access. There are a number of different types of linked lists: one-way lists, two-way lists, and circular lists. Linked lists can be implemented in a variety of programming languages. The built-in data types of languages like Lisp and scheme include the access and operation of the linked list. Programming languages or object-oriented languages such as c,c++ and Java rely on variable tools to generate linked lists.
Chinese name
Linked list
Foreign names
Linked list
Classification
Computer data structure
Constitute
A
series of nodes are formed.
Single linked list with nodes at the end of the arrows
Linear tablethe characteristic of a chained storage representation is to use a set of arbitraryStorage unitStorageLinear tableof theData elements(This set of storage units can be contiguous or discontinuous). Therefore, in order to represent eachData elementsThe logical relationship between its direct successor data elements, in addition to the data elements,StoreIn addition to its own information, it is necessary to store a message indicating its direct successor (i.e., a direct successor to the storage location). These two pieces of information form a "node" (as shown in the figure next to the overview), representing aData elements. The linear table of the chain storage, there is a drawback is to find a number, you have to start from scratch, very troublesome. Depending on the situation, you can also design other extensions of the list yourself. However, the data is not usually appended to the edge because the list of points and edges is basically one by one (except for the first or last node, but no special case is created). One exception is that if the list supports reversing the front and back pointers in a segment of the list, it may be more convenient to add the reverse tag to the edge.       for non-linear lists, see related other data structures, such as trees, graphs. There is also a data structure based on multiple linear lists: jumping tables, inserting, deleting, and finding basic operations can be as fast as O (NLOGN), and balanced binary trees. The domain in which the data element information is stored is called the data domain, and the domain where the direct successor is stored is referred to as the Pointer field (set the domain name to next). The information stored in the pointer field is also called a pointer or chain. By the distinction, ..., the N-nodes chain-linked list, called the linear table chain storage representation, because each node of such a list contains only one pointer field, it is also called a single-linked list or a linear list.                          ,         &NB Sp                          ,         &NB Sp                          ,         &NB Sp                                  &nbs P The   loop list is a chain-like storage structure that is the same as a single-linked list, unlike the pointer to the last node of the loop list, which points to the first node of the loop list or to the header node, thus forming a ring chain. The operation of the cyclic list is basically consistent with the operation of the single-linked list. The difference has the following points: 1, in the establishment of a circular chaintable, the pointer to its last node must point to the table header node instead of being null as a single-linked list. This situation is also used to insert a new node after the last node. 2, in determining whether to the end of the table, is to determine whether the value of the node chain is a table header node, when the value of the chain is equal to the table header pointer, the description has reached the end of the table. Instead of a single-linked list, the value of the chain field is not determined to be null. Two-way linked list is actually a single-linked list of improvements.        When we operate on a single-linked list, sometimes you have to work on a direct precursor to a node, and you must start by looking at the table header. This is limited by the structure of the single-linked list node. Because each node of a single-linked list has only one chain domain that stores direct successive node addresses, can you define a chain domain that has a direct successor node address, and a two-link domain node structure that stores the link domain of the direct predecessor node address? This is the doubly linked list. In the doubly linked list, the node is in addition to the data outside the domain, there are two chain domains, a storage direct successor node address, commonly referred to as the right link domain; A storage direct predecessor node address, commonly referred to as the left chain domain.

Java data-list (GO)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.