What is a stack? What are the two ways the stack works?

Source: Internet
Author: User


A stack is such a data structure. It creates a storage area in memory, in which the data is deposited in one order (i.e., "--push") in this area. There is an address pointer that always points to the data unit of the last data pressed into the stack, and the register that holds the address pointer is called the stack indicator. The unit that starts putting the data is called the "bottom of the stack." The data is deposited one by one, and this process is called "stack". In the process of pressing the stack, each data is pressed into the stack and placed in a subsequent cell connected to the previous unit, and the address in the stack indicator is automatically added 1. When reading this data, the number of addresses in the stack indicator is automatically reduced by 1 as the data is read from the address in the stack indicator. This process is called "pop POPs". In this way, the principle of LIFO is realized.

The most basic way to do this is to enter the stack and the stack





Last in, first out? What is the principle of access to stack data?
LIFO  or advanced post-out

What is a stack? What are the two ways the stack works?

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.