school/cs235/lab03/sm/ll.h

43 lines
773 B
C++

#ifndef __LL_H__
#define __LL_H__
#include <iostream>
#include <cassert>
#include "Factory.h"
using namespace std;
struct node {
int value;
node * next;
node(int value): value(value), next(NULL) {};
friend ostream & operator<<(ostream &, const node &);
};
class ll : public LinkedListInterface
{
private:
int _size;
public:
ll();
~ll();
node * head;
node * tail;
void insertHead(int value);
void insertTail(int value);
void insertAfter(int value, int insertionNode);
void remove(int value);
void clear();
int at(int index);
int size();
node * find(int value);
friend ostream & operator<<(ostream & os, const ll & i);
};
#endif