What is a linked list

Source: Internet
Author: User

  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.   Features the chain storage representation of linear tables is characterized by the use of a set of arbitrary storage units to store data elements of a linear table (this set of storage units can be contiguous or discontinuous). Therefore, in order to represent the logical relationship between each data element and its direct successor data element, in addition to storing its own information, it is necessary to store a message indicating its direct successor (that is, the direct successor storage location). These two pieces of information form a "node" (as shown in the figure next to the overview), representing a data element in a linear table. 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 linked lists, see related other data structures, such as trees, graphs. There is also a data structure based on multiple linear lists: Skip table, INSERT, delete and find basic operation speed can reach O (nlogn), as with the balanced binary tree. 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.

What is a linked list

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.