Stack

From NovaOrdis Knowledge Base
Revision as of 03:25, 11 August 2018 by Ovidiu (talk | contribs) (→‎Overview)
Jump to navigation Jump to search

Internal

Overview

A stack is a dynamic set in which the the DELETE operation, which does not have any argument, removes the most recently inserted element. The stack has a last-in-first-out, or LIFO policy. Also see Queue.

The INSERT operation for a stack is called PUSH. The DELETE operation is called POP.

Implementation

The following code shows how to implement a simple stack of ints, backed by an integer array.