-
Notifications
You must be signed in to change notification settings - Fork 2
/
LinkedList.cs
48 lines (44 loc) · 1.06 KB
/
LinkedList.cs
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
using Travelling_SalesMan_Problem;
namespace Lab_8
{
class LinkedList
{
Node start;
int length;
public LinkedList()
{
this.start = new Node();
}
public bool UnderFlow()
{
if (this.start.getNext() == null)
return true;
else return false;
}
public void InsertAtEnd(DeliveryBoy d)
{
Node n = new Node(d);
Node temp = this.start;
while (temp.getNext() != null)
temp = temp.getNext();
temp.setNext(n);
n.setNext(null);
this.length++;
}
public Node DeleteFromStart()
{
if (!this.UnderFlow())
{
Node temp = this.start.getNext();
this.start.setNext(temp.getNext());
this.length--;
return temp;
}
else return null;
}
public int getLength()
{
return this.length;
}
}
}