Untitled
unknown
plain_text
2 years ago
964 B
12
Indexable
class Node:
def__init__self(self,data=None):
self.data=data
self.next=None
class SLL:
def__init__(self):
self.head=None
def IAT(self,newdata):
NewNode=Node(newdata)
NewNode.next=self.head
self.head=NewNode
def RFN(head):
if(self.head==None):
return None
temp=head
head=head.next
temp=None
def RLN(self):
if self.is_empty():
print("Empty")
return
curr=self.head
prev=None
while curr.next!=None:
prev=curr
curr=curr.next
item=curr.data
if(prev==None):
self.head=None
else:
prev.next=None
curr=None
def printLL:
temp=sel.head
while(temp.next!=None)
print(t.data)
temp=temp.next
l=LinkedList()
l.IAT('a')
l.IAT('b')
l.IAT('c')
l.IAT('d')
l.IAT('e')
l.printLL()Editor is loading...
Leave a Comment