Single Linked list correlation algorithm

Source: Internet
Author: User

[1] Printed single linked list, void Printlist (List list);

Use a pointer to traverse all linked table nodes.

[2] Two ascending lists, printing the corresponding elements in the tarlist, which are specified by seqlist, void printlots (list tarlist, List seqlist);

Use two pointers to traverse two of the list, each time the sequence list of a serial number, according to the serial number, to reach the target list specified node.

[3] Two ascending list intersections, List Intersect (list L1, List L2);

[4] Two ascending lists and sets, List Join (list L1, List L2);

[5] Single linked list in place inverse, void Reverse (list L);

Uses three pointers to represent the predecessor, the current and subsequent nodes, each of the current node's next point to the predecessor node, and then traversing backwards until the end of the 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.