File SequenceStack.h

↰ Parent directory (ADS/stack)

SequenceStack is the STACK [see File ADT.h] simulated with the operations of any SEQUENCE, the top being its first item:

Definition (ADS/stack/SequenceStack.h)

Detailed Description

:math:`[

top() = read( head() ) qquad pop() = remove( head() ) qquad push( v ) = insert( head() , v ) ; ,

` which takes O( 1 ) time on a list with pointers, even a singly linked one (Esercizio 4.6), and has no capacity.

The contracts [see File Contract.h]: top() and pop() need a stack that is not empty, and push() ensures one that is not. The operations are defined in SequenceStack.tpp.

  1. Montresor, Algoritmi e Strutture Dati, 2025, section 4.3.1, https://algoritmicamente.it/materiali/libro/capitoli/cap04.pdf

Donato Meoli

Dipartimento di Informatica Universita’ di Pisa

by Donato Meoli

Includes

Included By

Namespaces

Classes