-
Notifications
You must be signed in to change notification settings - Fork 0
/
Program.cs
36 lines (31 loc) · 851 Bytes
/
Program.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
using System;
using SimpleTypes;
using CollectionTypes;
namespace DataStructures
{
class Program
{
static void Main(string[] args)
{
LinkedList<int> list = new LinkedList<int>();
list.AddHeadNode(0);
for (int i = 1; i < 10; i++)
{
list.AddTailNode(i);
}
Console.WriteLine(list);
Node<int> current = list.Head;
for (int i = 0; i < 10; i++, current = current.Next.Next)
{
list.AddNodeAfter(current, 0 - current.Data);
}
Console.WriteLine(list);
foreach (Node<int> node in list)
{
if (node.Data >= 0)
list.RemoveNodeAfter(node);
}
Console.WriteLine(list);
}
}
}