Linear table: Table and order list - Data Structures and Algorithms

Creative Commons License Copyright: Attribution, allow others to create paper-based, and must distribute paper (based on the original license agreement with the same license Creative Commons )
I. Overview of the sequence table

Order table opened continuous space, the data is stored sequentially.

Second, the list Overview

1, a single chain
single chain pointer is unidirectional, the first node pointing to the first element, the first element points to the second element, the second element refers to the third element ...... and so on.
2, a circular linked list
pointer points to the tail element of the head node is the head node point advantage: if the current pointer is at the end of the element, to be positioned at the time of any other element, it may be next, to locate it. Without re-positioning the head node began.
3, doubly linked list
single linked list can point in one direction, while the double linked list can point in both directions.

Third, the list of operations

1, delete node singly linked list
Here Insert Picture Description

q->nest = p->next

2, a single linked list insert node
Here Insert Picture Description

s->next = p->nest
p->next = s

3, doubly linked list delete node
Here Insert Picture Description
4, doubly linked list insert node
Here Insert Picture Description

Single list is not divided and the head node of the head node, the first node does not exist any information, a storage element before the head node information. Has a head node of the benefits are: the introduction of the head node allows operation of all nodes become consistent. If the head node that is stored there other elements specific content, often need to take a different approach.

Guess you like

Origin blog.csdn.net/Thanlon/article/details/93520690