Advertisement
kucheasysa

Algoverse_adesh_33

Jul 2nd, 2024
424
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.31 KB | None | 0 0
  1.  def insertAtBegining(self,head,x):
  2.         temp=Node(x)
  3.         temp.next=head
  4.         return temp
  5.     .
  6.     def insertAtEnd(self,head,x):
  7.         if head is None:
  8.             return Node(x)
  9.         curr=head
  10.         while curr.next:
  11.             curr=curr.next
  12.         curr.next=Node(x)
  13.         return head
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement