Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def insertAtBegining(self,head,x):
- temp=Node(x)
- temp.next=head
- return temp
- .
- def insertAtEnd(self,head,x):
- if head is None:
- return Node(x)
- curr=head
- while curr.next:
- curr=curr.next
- curr.next=Node(x)
- return head
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement