Data structure----Collection--linked list

Source: Internet
Author: User
data structure of the main two points

The complexity of the time , how to make the program run faster. As soon as possible.

How space complexity can occupy less memory space

program robustness Some programs are simply error-prone, unstable

Reverse engineering is not his, his understanding of the principle of their own writing, with their own linked list concept

A collection is a chain of tables created on the basis of

The defect of array as data storage structure in unordered array, the efficiency of search is inefficient and the insertion efficiency is very low in an ordered array no matter in which array, the deletion efficiency is very low after the array is created, its size is immutable

A linked list can be an ordered or unordered list of linked table contents that are typically stored in an in- memory distributed location on a linked list consisting of nodes, each node having the same structure Divided into the data domain and the chain domain , the data domain is the content that holds the node, the chain domain is the pointer which holds to the next node address

using programming ideas to understand the relationship between linked lists and nodes a list has many similar nodes, so it is necessary to use a description node to Express the node, which we become node Each node object contains a data part that represents the contents of the node, which we call the data field , and a reference field to the next node next, that is, the link field

linked list Concept map

The next node type is nodes, which is the node class type, so this is another recursive, knowing that node is null, then recursion ends "self-reference"

In a normal application, you can use an object of a class that contains multiple data to replace the basic operation of the list of data items "single-linked list"

Build Table

Also known as initialization its role is to establish an empty table, L=null, that is, the establishment of the "table schema" of the scale, but does not include any data elements linked list of the first node is also known as the head node , the structure of the head node and ordinary nodes, usually we will be specified at the beginning of the list The last node in the list is an empty node, represented as null in the program, and also to represent the identity of the end of the borrowing point, each node is an object, in order to avoid throwing null pointers to the exception of the programming judgment to judge Null before judging equals, these two are different.

Length of the table
The chain table length is a few nodes

Read linked list node
is to traverse the linked list

Adding nodes
Insert a new node

Delete a node
Delete the specified node
The computer actually does not delete things, just put the pointer away, so what used to say what hard disk recovery, is basically like this, so through the normal index AH, directory Ah can't find him
But it had to be just deleted when, did other operations, it is possible to cover him off, the directory is like a list
Find by Ordinal
positioning
is to find other linked lists

Circular link List
Double 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.