Data structure-linked list

Source: Internet
Author: User
Table that writes abstract data types today

What is an abstract data type (ADT)?

is to define a mathematical model and the operation of the mathematical model.

Now let's talk about today's big head, LIST ADT.

Speaking from the simplest format of the table

Array

The mathematical model of the array is arr=[1,2,3];

The operation of an array is to print the group and find the elements, which can be added by themselves, such as looking for previous or next.

What's wrong with arrays? is to delete and add the time, need to the entire array.

For example, to add an element to the front of the array, move all the elements backwards.

For example, to delete an element in front of the array, move all the elements forward.

To solve this problem, take a look at today's second table

Linked list

The list solves the problem of having more time to add and delete elements in the array, because the structure in the list is not ordered in memory.

Each structure in the list has an element and pointer,element containing elements, and pointer points to the address of the next structure. Look at the picture below.

Of course, there are some problems with linked lists. For example how to insert before the first structure, delete the first structure how ADT could not find it. These problems can be solved with the head element and the subscript 0 thing.

For linked lists, there are also some actions to insert and delete.

Data structure-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.