previous | index | next

A More Efficient Method of Reversing

List to be reversed    Reversed list so far
(1 2 3 4 5) ()
(2 3 4 5) (1)
(3 4 5) (2 1)
(4 5) (3 2 1)
(5) (4 3 2 1)

previous | index | next