notebook.community
Edit and run
Last In First Out (LIFO)
Numerous applications:
Can be implemented via
Singly linked list
Two references to the head and tail of the list: list_head and list_tail
class Single_list { public: Single_list(); ~Single_list(); int size() const; int };
template <typename Type> class Stack { private: Single_list<Type> list; public: bool empty() const; Type top() const; void push(Type); Type pop(); };
In [ ]: