26 #ifndef SCIRE_struct_stack_HPP
27 #define SCIRE_struct_stack_HPP
38 template<
typename Type,
typename SzType =
int>
49 virtual bool Push(
const Type& element) = 0;
55 virtual bool Pop() = 0;
61 virtual Type
Top()
const = 0;
66 virtual SzType
Size()
const = 0;
70 bool Add(
const Type& element)
98 template<
typename Type,
typename SzType =
int>
100 :
public AStack<Type, SzType>
110 bool Push(
const Type& element);
130 Node(
const Type& newElement, Node *nextNode)
131 : element(newElement), next(nextNode) {}
156 while (
node !=
nullptr) {
181 if(
this->
top==
nullptr)
205 template<
typename Type,
typename SzType =
int>
207 :
public AStack<Type, SzType>,
208 public ICrate<Type, SzType>
224 bool Push(
const Type& element);
289 if (
size <= 0)
return false;
Type Peek() const
peek into next element contained in
virtual SzType Size() const =0
number of elements contained in
Type Top() const
Access the top element of stack.
bool Add(const Type &element)
add an element
virtual bool Push(const Type &element)=0
Push a new element at the top of stack.
Linked list implementation of stack.
SzType Size() const
number of elements contained in
bool Push(const Type &element)
Push a new element at the top of stack.
virtual bool Pop()=0
Pop (remove/deduce) an element from the top.
scire/graph/gale_shapley.hpp
~StackCrate()
finalize a StackCrate object by deleting array crate
bool Pop()
Pop (remove/deduce) an element from the top.
Standard stack abstraction (Push, Pop, Top).
~Stack()
finalize a Stack object by deleting all items from it
StackCrate(SzType stackCapacity)
initialize a StackCrate object and allocate array crate
Type Top() const
Access the top element of stack.
SzType Size() const
number of elements contained in
array implementation of stack
bool Deduce()
deduce one element
Stack()
initialize a Stack object, with top pointing to nullptr
Crate contains elements in an arrays.
bool Pop()
Pop (remove/deduce) an element from the top.
bool Push(const Type &element)
Push a new element at the top of stack.
virtual Type Top() const =0
Access the top element of stack.