Initialization of a doubly linked list destroys insert Delete

Source: Internet
Author: User

Initialize: The end node of the head node is assigned a null value.
Delete: Determine the condition of the chain table length to make a conditional delete release

Insert: 1, insert after a node

2, insert in front of a node

1) A, allocation node failure return-1

b, the list length is 0.

The tail of the head is linked to the new node, and the end of the head of the new node is set to empty.

The normal insertion of four steps also determines whether the next node of the inserted node is empty.

2) A, check that the node space is allocated successfully.

b linked list length 0 normal thinking.

Determine if the node in front of the insertion position is empty normal thinking

Initialization of a doubly linked list destroys insert Delete

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.