Common linear list Structure---"arrays, lists, stacks, queues, heaps"

Source: Internet
Author: User


The list of the most common linear structures we have in algorithmic design is just a few:

1. Arrays:

The array should be one of my most common. His storage address is continuous, that is, when we open an array, we will assign him a continuous address. Since his address is continuous, it is very fast to find the element when we know he is subscript.

2. Linked list:

The position of the elements in the list is not fixed, and each node in the list has a head pointer and a tail pointer, which connects the elements in the list so that the time to find an element is related to the position of the element. But he has an edge over space.

3. Stack:

A feature of the elements in the stack is the principle of "FIFO first". We can use a stack of plates as a metaphor, and every time we add a new dish and take a dish, we do it on top, and he has a wide range of applications.

4. Queue:

In the queue, we operate on the elements in the team head and tail respectively. The insertion of elements at the end of the team, the deletion of elements in the team head. In the graph of the problem above the use of more.

5. Heap:

Heap is a common structure to solve two-fork tree, and is an optimal structure of priority queue.



These are very basic and very important points of knowledge, so you have to master anyway. The rest of the nonsense is not much to say, I will be for each structure to do a detailed sharing, I hope that we have a lot of support, common learning common progress.

Common linear list Structure---"arrays, lists, stacks, queues, heaps"

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.