We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents 1a315ca + f3369f0 commit 479d737Copy full SHA for 479d737
LinkList in phyton
@@ -0,0 +1,30 @@
1
+# A simple Python program to introduce a linked list
2
+
3
+# Node class
4
+class Node:
5
6
+ # Function to initialise the node object
7
+ def __init__(self, data):
8
+ self.data = data # Assign data
9
+ self.next = None # Initialize next as null
10
11
12
+# Linked List class contains a Node object
13
+class LinkedList:
14
15
+ # Function to initialize head
16
+ def __init__(self):
17
+ self.head = None
18
19
20
+# Code execution starts here
21
+if __name__=='__main__':
22
23
+ # Start with the empty list
24
+ llist = LinkedList()
25
26
+ llist.head = Node(1)
27
+ second = Node(2)
28
+ third = Node(3)
29
+ llist.head.next = second; # Link first node with second
30
+ second.next = third;
0 commit comments