-
Notifications
You must be signed in to change notification settings - Fork 0
/
LinkedList.h
57 lines (41 loc) · 1.18 KB
/
LinkedList.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
//
// Created by Brady Cash on 11/8/21.
// BPC210000
#ifndef INC_1337PROJECT4_LINKEDLIST_H
#define INC_1337PROJECT4_LINKEDLIST_H
#include "iostream"
#include "Node.h"
class LinkedList {
private:
Node *Head;
int Length;
//sorting helper functions
Node *merge(Node *node1, Node *node2);
void sortHelper(Node *&);
public:
LinkedList(); //default constructor
LinkedList(const LinkedList &); //copy constructor
//recursive deconstructor helper function
void deconstruct(Node* node);
//deconstructor
~LinkedList();
//accessors-getters
int getLength() const { return Length; }
Node *getHead() const { return Head; }
//mutators-setters
void setLength(int num) { Length = num; }
void setHead(Node *node1) {
Head = node1;
Length = listLength(node1);
}
//overloaded += operator
void operator+=(Node *);
int listLength(Node *);
//csorting function
void sortList();
//overloaded [] operator
Node *operator[](int pos);
//overloaded << operator
friend std::ostream &operator<<(std::ostream &stream, LinkedList source);
};
#endif //INC_1337PROJECT4_LINKEDLIST_H