Skip to content

Instantly share code, notes, and snippets.

View zhhailon's full-sized avatar

zhhailon zhhailon

View GitHub Profile
template <typename T> class ArraySet {
private:
T *items;
int count;
public:
/** Create an empty set. */
ArraySet() {
items = new T[100];
count = 0;
/** List abstract class. */
template <typename ItemType> class List {
public:
virtual int size() const = 0;
virtual ItemType &get(int i) = 0;
virtual const ItemType &get(int i) const = 0;
virtual void insert(const ItemType &x, int i) = 0;
virtual ItemType remove(int i) = 0;
virtual void addFirst(const ItemType &x) = 0;
virtual void addLast(const ItemType &x) = 0;