-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathProgram.cs
More file actions
63 lines (58 loc) · 1.69 KB
/
Program.cs
File metadata and controls
63 lines (58 loc) · 1.69 KB
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
58
59
60
61
62
63
using System;
namespace ScratchGraphs
{
class Program
{
static void checkList(LinkedList list)
{
if (list.head()== null)
{
System.Console.WriteLine("Null");
}
else
{
System.Console.WriteLine(list.head().val);
}
System.Console.WriteLine(list.count());
System.Console.WriteLine(list.isEmpty());
}
static void checkNode(LLNode node)
{
if (node.val == null)
{
System.Console.Write("Null"+ " ");
}
else
{
System.Console.Write(node.val + " ");
}
if (node.next == null)
{
System.Console.WriteLine("Null");
}
else
{
System.Console.WriteLine(node.next);
}
}
static void Main(string[] args)
{
Console.WriteLine("Hello World!");
LLNode newNode = new LLNode();
checkNode(newNode);
LLNode valNode = new LLNode(5);
checkNode(valNode);
LinkedList newList = new LinkedList();
newList.add(4);
checkList(newList);
newList.add(15);
newList.add(10);
System.Console.WriteLine(newList.Contains(4));
System.Console.WriteLine(newList.Contains(10));
LinkedList emptyList = new LinkedList();
checkList(emptyList);
System.Console.WriteLine(emptyList.Contains(4));
System.Console.WriteLine(emptyList.Contains(null));
}
}
}