Current location - Training Enrollment Network - Mathematics courses - Java problem, what's the difference between linked list and sequential list? I know the sequence table, but why do you say that reading data from the linked list should start from scratch?
Java problem, what's the difference between linked list and sequential list? I know the sequence table, but why do you say that reading data from the linked list should start from scratch?
Upstairs connection: to be precise, your problem is a data structure problem.

First, you should distinguish between physical storage structure and logical data structure.

Physical storage structure

Chain storage structure

Sequential storage structure

logical data structure

Linear data structure: single linked list, double linked list, circular linked list (stack queue ...)

Trees: ordinary trees, special trees

Look-up table: static look-up table and dynamic look-up table.

Graphs: directed graphs ...

When any logical data structure is to be represented on a computer, you must choose a physical storage structure according to your own needs and then store it according to the characteristics of the logical data structure.

For the physical storage structure

Sequential storage structure: As long as the base address is known, the address of any element can be calculated mathematically.

Chain storage structure: you can't go beyond home. You know who dad is, but you don't know who grandpa is. You can only find grandpa through dad. (The address of the next node is stored in the last node. )

This characteristic is determined by its physical realization, and there is no way to change it at present.

Look back at two key concepts in your question:

Linked list: linear tables stored in a chained storage structure are called linked lists.

Sequential table: The linear table stored in the sequential storage structure is called sequential table.

So:

Sequential tables can access any element at a time, while linked lists need to traverse in most cases.