3.31 Efficiently implement a stack class using a singly linked list, with no header or tail nodes.
3.32 Efficiently implement a queue class using a singly linked list, with no header or tail nodes.
3.33 Efficiently implement a queue class using a circular array. You may use a vector (rather than an primitive array) as the underlying array structure.
//3.31-3.32 slist.hpp
#ifndef SSList_HPP__
#define SSList_HPP__
template< typename Object >
class SListStack;
template< typename Object >
class SListQueue;
#include <iostream>
template< typename Object >
class SList {
private:
class Node {
public:
Node(const Object& val = Object(), Node* n = 0)
: next(n), data(val){}
public:
Node* next;
Object data;
};
public:
SList() : theSize(0), head(0),tail(0){}
~SList()
{