Home  >  Article  >  what is stack

what is stack

藏色散人
藏色散人Original
2019-06-12 12:00:1914565browse

what is stack

A stack (English: stack), also known as a stack or stack, is an abstract data type in computer science that allows only one end of an ordered linear data collection (called The top of the stack (English: top) performs operations of adding data (English: push) and removing data (English: pop).

So it operates according to the principle of LIFO (Last In First Out).

Often compared to another ordered linear data collection queue.

Stacks are often implemented with one-dimensional arrays or linked lists.

Operations

The stack uses two basic operations:

Push (push) and pop (pop) ):

● Push: Put data on the top of the stack, and move the top of the stack to the newly placed data.

● Pop-up: Remove the data at the top of the stack, and move the top of the stack to the next piece of data after removal.

Features

Basic features of the stack:

● First in, last out, last in, first out.

● Except for the head and tail nodes, each element has a predecessor and a successor.

The above is the detailed content of what is stack. For more information, please follow other related articles on the PHP Chinese website!

Statement:
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