Category: Linked List

Rearrange linked list in specific manner in linear time

Given a linked list, rearrange linked list nodes in specific way in linear time and constant space. The alternate positions in the output list should be filled with the nodes starting from the beginning and from the very end of the original list respectively.

Merge two sorted linked lists from their end

Write a function that takes two lists, each of which is sorted in increasing order, and merges the two together into one list which is in decreasing order and return it. In other words, merge two sorted linked lists from their end.