ADS
Algorithms and Data Structures
Loading...
Searching...
No Matches
stack Directory Reference

Files

 
ArrayStack.h
 The STACK of the book [see ADT.h] realized with a vector of a given capacity \( c \): the \( n \) items are in the first \( n \) places, the top in the place \( n - 1 \), so that every operation takes \( O( 1 ) \) time.
 
Expressions.h
 Arithmetic expressions with a STACK [see ADT.h], beyond the book: the operands are nonnegative integers, the operators the binary +, -, * and / (the division truncated toward zero), and the tokens of an expression may be separated by spaces.
 
MinStack.h
 The STACK with the minimum of exercise 3.14 of Morin's book, beyond the book [see ADT.h]: push(), pop(), top(), size() and min(), the least item inside, all in \( O( 1 ) \) amortized time (worst case but for the doublings of the vectors).
 
MultiStack.h
 \( k \) STACKs in one structure [see ADT.h], beyond the book: the items of all the stacks are cells of a single vector, each linked to the cell below it in its stack, and the free cells form a further list, so that the stacks share the space and none is full while the others have room (the vector, a std::vector, grows by a constant factor when all the cells are used).
 
SequenceStack.h
 SequenceStack is the STACK [see ADT.h] simulated with the operations of any SEQUENCE, the top being its first item:
 
StackAlgorithms.h
 Algorithms that use a STACK [see ADT.h] only through its operations, beyond the book: