jeudi 27 mai 2010

Reverse a list


def reverse(n):
previous = n
current = n.next

while current:
next = current.next
current.next = previous
previous = current
current = next
return current

Aucun commentaire:

Enregistrer un commentaire