Auxiliary code for linked list related problems.