Home > Common Problem > The stack is a first-in-first-out linear list, right?

The stack is a first-in-first-out linear list, right?

王林
Release: 2020-07-11 11:32:28
Original
9685 people have browsed it

The stack is a first-in-first-out linear list, which is wrong. The stack is a first-in-last-out list. As a data structure, the stack is a special linear list that can only perform insertion and deletion operations at one end. The end that allows insertion and deletion operations is called the top of the stack, and the other end is the bottom of the stack.

The stack is a first-in-first-out linear list, right?

The stack is a first-in-first-out linear list, which is wrong.

Related introduction:

The stack is also called the first-in-last-out table.

Stack, as a data structure, is a special linear table that can only perform insertion and deletion operations at one end.

It stores data according to the principle of first in, last out. The data that enters first is pushed to the bottom of the stack, and the last data is on the top of the stack. When data needs to be read, data is popped from the top of the stack (the last data is pushed to the bottom of the stack). one read out). The stack has a memory function. During insertion and deletion operations on the stack, there is no need to change the bottom pointer of the stack.

A stack is a special linear list that allows insertion and deletion operations at the same end.

The end that allows insertion and deletion operations is called the top of the stack (top), and the other end is the bottom of the stack (bottom); the bottom of the stack is fixed, and the top of the stack floats; when the number of elements in the stack is zero, it is called Empty stack. Insertion is generally called PUSH, and deletion is called popping (POP).

The above is the detailed content of The stack is a first-in-first-out linear list, right?. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template