Skip to content

Commit 3dcaead

Browse files
committed
Linked Lists Problems
1 parent 54cc9ab commit 3dcaead

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# Author: OMKAR PATHAK
2+
3+
import SinglyLinkedList
4+
5+
def checkLength(linkedList):
6+
count = 0
7+
temp = linkedList.head
8+
while(temp != None):
9+
count += 1
10+
temp = temp.next
11+
12+
return count
13+
14+
if __name__ == '__main__':
15+
myLinkedList = SinglyLinkedList.LinkedList()
16+
for i in range(10):
17+
myLinkedList.insertAtStart(i)
18+
myLinkedList.printLinkedList()
19+
print()
20+
print('Length:', checkLength(myLinkedList))
21+
22+
# OUTPUT:
23+
# 9 8 7 6 5 4 3 2 1 0
24+
# Length: 10

0 commit comments

Comments
 (0)