Data structure: the definition and operation of stacks and queues

Source: Internet
Author: User

First, stack and queue definitions

1), Stack

Defined:

Stacks (stack) is a linear table of LIFO (last into first Out,lifo) that requires deletion and insertion only at the end of the table.

The figure is as follows:

Characteristics:

First, the stack of special linear table (sequential table, linked list), it has some special requirements and restrictions on the operation: the stack elements must be "LIFO first."

Third, the stack of the end of the stack is called Stack top, the corresponding table header called Stack bottom (bottom)

The operation of the stack can only be done at the end of the linear table.

2), queue

Defined:

Queues are special linear tables that qualify to be inserted at one end of a table and delete at the other end of the table.

The figure is as follows:

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.