A set of linked list algorithms for set frames

Source: Internet
Author: User
Linked List collection algorithm:

1. Chain = Reference
2. The difference between a set of linked lists and an array set: In terms of value-added, the speed of the array collection is faster than the set of linked list algorithms "Learning Java, to the Kaige123.com Academy", but the list of linked lists is more flexible in terms of adding and removing values and modifying values, and its principle is like a chain.
3. List of categories:
3.1 Single-chain set (to understand): Home can find home, but the next home can not find the home, that is, through the previous array to find an array, but no way to find the previous array through the next array. Such as:

3.2 Double chain set: Home can find home, the home can also find home. Such as:

4. Code implementation (double chaining as an example):
4.1 Adding values

4.2 Adding values to the head

4.3 Add value at tail

4.4 Delete First Value

4.5 Delete last value

4.6 Add a value at the specified location


4.7 Delete Values by subscript


4.8 Improved version of the delete operation: the deleted value can be returned when the delete operation is performed

5. Usage: The list of linked lists is used in queue mode, and the task is queued in a series of operations. Take the queue pattern as an example: the benefits of queuing "learning Java, to the Kaige123.com school" is the first to take out the execution, such as, can be taken before the value, the back of the value, of course, can also go forward

A set of linked list algorithms for set frames

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.