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

Popular posts from this blog

java - WrongTypeOfReturnValue exception thrown when unit testing using mockito -

php - Magento - Deleted Base url key -

android - How to disable Button if EditText is empty ? -