-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathLinkedList.cs
More file actions
46 lines (35 loc) · 870 Bytes
/
LinkedList.cs
File metadata and controls
46 lines (35 loc) · 870 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
41
42
43
44
45
using System;
using System.Collections.Generic;
namespace LinkedListAlgo
{
class LinkedList
{
Node head;
public class Node
{
public int data;
public Node next;
public Node(int d)
{
data = d;
}
}
public void PrintList(){
Node n = head;
while(n != null){
Console.Write(n.data + " ");
n= n.next;
}
}
public static void MainC(string[] args)
{
LinkedList linkedList = new LinkedList();
linkedList.head = new Node(1);
Node second = new Node(2);
Node third = new Node(3);
linkedList.head.next = second;
second.next = third;
linkedList.PrintList();
}
}
}