//**************************************************************
//
// CS 240B : Winter 2003 Ohio University Travis Dillon
// Project 5 : linked list
// file : list.h
// started : 02-27-03
//
//**************************************************************
#ifndef LIST_H
#define LIST_H
#include "node.h"
class List
{
public:
List(); //default c-tor (empty)
List(T dat_arr[], int size); //array of T c-tor
List(const List& orig); //copy c-tor
~List(); //x-tor
List& operator =(const List& rop); //assignment op
bool operator !=(const List& rop)const; //inequality op
bool operator ==(const List& rop)const; //equality op
friend ostream& operator <<(ostream& os, const Node& rop);
friend ostream& operator <<(ostream& os, const List& rop);
void tell_all(ostream& os, string name = "", int max_to_tell = 123456);
void push_back(const Node& in); //add node to back of list
void push_front(const Node& in); //add node to front of list
void push_before(int loc, const Node& in); //add in before loc, else at end
void push_in_order(const Node& in); //add node into sorted list
void push_in_order(const T& in); //create and add node
void steal(List& rl); //move nodes from rl to end of ll
void operator +=(const List& rl); //append rl onto ll
Node* get_back(); //ptr to last node, or NULL if empty
Node* get_front(); //ptr to first node, or NULL if empty
Node* get_at(int n); //ptr to n-th ele, or last if < n
void pop_back(); //pop last node
void pop_front(); //pop first node
void pop_at(int n); //pop n-th ele, or last if < n
void strip(); //remove all nodes
bool is_empty(); //return true if empty
bool is_sorted(); //return true if list is sorted
int count(); //count number of nodes
Node* search(T tar); //return ptr to data, or NULL
Node* find_min(); //return address of min element
void generic_sort(); //my list sort
void selection_sort();
friend void sorted_merge(List& out, List& in1, List& in2);
//in1 and in2 are sorted lists, out is empyt. in and in2
//are moved into out s.t. sorted
private:
Node* first;
};
#endif //LIST_H