Single-linked list use dummy node to avoid special situation advantages more than harm?

Source: Internet
Author: User

The dummy node is the root of the linked list.  In general, the insertion of a single-linked list takes into account the processing of an empty list, but if there are dummy nodes, this is not necessary.

Is that good?

If so, you need to make sure that the single-linked list has dummy nodes before entering the insertion function, so you need to create it, and you need to skip the dummy node each time you manipulate the single-linked list.     In other words, the addition of dummy nodes does not reduce the processing of special cases, instead, these processes are dispersed into other functions. I think that in order to improve the independence of the module, the empty list should be processed to fill up.

Single-linked list use dummy node to avoid special situation advantages more than harm?

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.