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