Talk C Chestnut Bar (15th time: C-language example-doubly linked list)

Source: Internet
Author: User


Crossing, everyone, from today onwards, we talk about the large-scale couplet science fiction: C Chestnut, that is, C language examples. Gossip Hugh,

Words return to the positive turn. Let's talk C chestnuts together!


Crossing, the last time we were talking about the example of a circular link list, this time we say the example is: doubly linked list.


Crossing, doubly linked list is also a kind of linked list. The list that we talked about in the previous two, is all along the chain list head to the tail of the chain

To do, and today we're going to say that the two-way list can be moved along the chain list head to the tail of the list, or along

The tail of the linked list to the head of the linked list in such a direction to operate. That's why it's called a doubly linked list.


In the example, the function of finding and deleting nodes can be found or deleted in a direction such as the tail of the linked list to the head of the linked list,

Of course, it is possible to find or delete the same way as a single-linked list along the head of a linked list to the tail of a linked list. No matter which direction you follow

operation, you just need to focus on the direction of the pointer. For example, in the direction of the linked list head to the tail of the linked list of related operations, only

You need to focus on the next pointer in the node, and the pre pointer can be ignored. However, the delete operation needs to be noted because it removes a

Meet the requirements of the node, delete the node must be the pre and next pointers are handled well, otherwise it will destroy the completion of the list, in

After the delete operation, if the traversal operation, it will be because the list is incomplete, not all the nodes in the linked list, that is to form a broken

Chain, which is the most serious mistake. I have Chinese comments in the code.


Crossing, the text does not write code, the detailed code put in my resources, you can click the link to download the use.


You crossing, for example of a doubly linked list, let's talk about this. I want to know what the following example, and listen to tell.

Talk C Chestnut Bar (15th time: C-language example-doubly 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.