During one interview I was asked to write an algorithm to reverse a singly-linked list. This is a data structure that can only be traversed in one direction, kind of like driving down a one-way street.
It is important to know how a linked list differs from an array. An array can also be used as a list, so when are linked lists more appropriate?
Continue reading...