-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathLinkedList.h
More file actions
40 lines (38 loc) · 1022 Bytes
/
Copy pathLinkedList.h
File metadata and controls
40 lines (38 loc) · 1022 Bytes
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
#pragma once
#include "Node.h"
#include <string>
#include <iostream>
using namespace std;
class LinkedList {
public:
// Constructors
LinkedList();
LinkedList(const LinkedList& other);
~LinkedList();
// Element Access
string& at(int index);
string& front();
string& back();
// Modifiers
void push_back(const string& value);//or append
void pop_back();
void push_front(const string& value);
void pop_front();//remove first
void insert_at(int index, const string& value);
void insert_after(int index, const string& val);
void erase_at(int index);
void erase(const string& e);
void clear();//delete all nodes to make list empty
// Capacity
int size() const;
bool empty() const;
//TASK 3.3 3.4 3.5
Node* findMiddleNode();
Node* getSmallestNode();
void moveSmallestToFront();
LinkedList& operator=(const LinkedList& lhs);
bool operator==(const LinkedList& lhs)const;
friend ostream& operator<<(ostream& out, const LinkedList& list);
private:
Node* head;
};