#ifndef LINKEDLIST_HEADER
#define LINKEDLIST_HEADER

#define NULL 0

#include<iostream>
#include<fstream>
#include "mpi.h"

typedef struct Node {
	int value;
	Node * next;
} Node;

class LinkedList {

public:

	LinkedList();

	void makeEmpty();
	void insert(int);
	int get(int);
	int length();
	int find(int);
	int* toArray();
	void destroyArray();

private:

	Node* head;
	Node* tail;
	int size;
	int * array;

	int get_r(int, Node);
	int find_r(int, Node, int);
	void deleteList(Node*);
	

};

class IndexOutofBoundsException {
public:
	IndexOutofBoundsException()
		: message("attempted access to an invalid data structure element"){}
		const char *what() const {return message;}
private:
	const char *message;
};

#endif