-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathList.h
40 lines (32 loc) · 934 Bytes
/
List.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
#pragma once
#include "ListNode.h"
class List
{
private:
ListNode* head;
//ListNode* nextPos;
ListNode* tail;
int numberOfNeighbors;
public:
ListNode* MakeNewNode(int vertex, ListNode* prev = nullptr, ListNode* next = nullptr);
List();
~List();
//Getters
ListNode* GetHead() { return head; }
ListNode* GetTail() { return tail; }
int GetNumberOfNeighbors() { return numberOfNeighbors; }
//Setters
void SetHead(ListNode* newHead) { head = newHead; }
void SetTail(ListNode* newTail) { tail = newTail; }
void AddToHead(ListNode* newNodeToAdd); //after"dummy head"
ListNode* RemoveFromTail();
bool IsEmpty();
void ClearList();
void MakeEmptyList(int vertex);
int GetListHeadValue();
ListNode* GetListHead(); // return first neighbor
bool IsNodeInList(int vertex);
ListNode* FindNodeByData(int vertex);
bool RemoveFromList(int vertex);
int AddToList(int vertex);
};