-
1. The pointer of the last node points to a different point.
When creating a round-robin linked list, the pointer of the last node must point to the header node, rather than null as in the case of doubly linked lists. This condition is also used to insert a new node after the last node.
2. Judge the value of the chain domain is different.
When determining whether the value of the node is at the end of the table, it is to determine whether the value of the chain domain of the node is the header node, and when the value of the chain field is equal to the pointer of the header, it means that the end of the table has been reached. Rather than determining whether a chain field value is null or not, as is the case with a singly linked list.
3. Access method:
Round-robin linked list: You can start at any node and access backwards to any node.
Doubly linked lists: You can access any forward and backward bidirectional from any node.
4. Operation: Circular linked list: can only be inserted and deleted after the current node.
Doubly linked list: can be inserted before or after the current node, and can delete the predecessor and successor (including the node itself).
5. Storage: The storage density of a circular linked list is greater than that of a double-linked list.
-
The circular link means that the linked list forms a ring, that is, the last node points to the head node, so that a ring is formed; It is divided into single-cycle linked list and double-cycle linked list;
A doubly linked list means that each node has 2 sub-nodes, one pointing to its predecessor and the other pointing to its successor; It is generally a double-cycle linked list.
-
Just a two-way way to give you a reference. Adding a loop shouldn't be too much of a problem for you.
-
#include
#include
struct node ;
void create(struct node *list, int n)
n2 = list;
list = list->next;
list->prev = n2;
printf("%d node input data:", i + 1);
scanf("%d", &list->data);
list->next = n1;
n1->prev = list;
void print(struct node *list, struct node *head)
if (list->next != head)}int main()
printf("Number of input nodes:");
scanf("%d", &n);
create(head, n);
print(head, head);
return 0;}
-
In a singly linked list, starting from a known node, only that node and its successors can be accessed, and no other nodes before the node can be found. In a single-round linked list, although all nodes in the table can be accessed from any node, the time complexity of accessing the direct predecessor node of the node is o(n). In addition, in a single-linked list, if the storage location p of a node is known, it is not as convenient to insert a new node s before p (called pre-insertion), because the direct pre-interpolation position of p must be known for the pre-insertion operation.
In the same way, the deletion of p itself is not as convenient as the direct successor to the deletion of p. Therefore, due to the disadvantages of singly linked lists, biaquitously linked lists were introduced.
1.The concept of a double-linked list refers to the establishment of two pointer fields in each node that constitutes a linked list: one to the pointer domain of its direct predecessor, and the other to the pointer field ne*t of its direct successor.
In this way, there are two chains in different directions in the linked list, so it is called a doubly linked list.
2.A double-dipping linked list can also form a round-robin linked list by linking the first and last nodes of a double-linked list, which is called a double-headed round-robin linked list.
Figure 1: The two-way chain represents the meaning.
Biological circulating water defoamer is suitable for all kinds of circulating cooling water treatment, sewage treatment, circulating industrial sewage, circulating wastewater treatment in various industries at room temperature, alkali system water treatment, etc., biological circulating water defoamer should be stirred evenly before use, and directly poured or drip addition when used; If used after layering and stirring, it will not affect the effect; The recommended dosage can be increased or decreased on a case-by-case basis.
Modify network parameters? Can you elaborate on what you want to change?
Hello, Mercedes-Benz C200 child lock is used as follows: The child protection lock on the rear door can lock the rear door separately. When the child lock is activated, the corresponding rear door cannot be opened from inside the vehicle. After the vehicle is unlocked, the rear doors can be opened from the outside. >>>More
In C, all preprocessing commands start with a " " sign.
The concept of preprocessing in C programming: processing before compilation. There are three main aspects of preprocessing in C: macro definition and failing. >>>More
The Z-transformed filter can be implemented in C in the form of a digital filter. The specific implementation method is as follows:1 >>>More