linked list beginning and end in python -
here question have linked list of 1->2->3->4->5
my concept print them 1->5->2->4->3
it means first beginning , end
how can it?
i have idea first take empty node in empty node keep beginning node and
after traverse last , end node kept there @ brain stops
can guide me this? in advance
def mutate_linked_list(head): #node creation s = t = node() t.next = head head = head.next while head none: t.next = head head = head.next # here used recursion concept mutate_linked_list(head) return head
but not working....
[head[0]]+[head[-1]] + head[1:-1]
Comments
Post a Comment