Tag: reorder
-
Data Structures & Algorithms in Java – Linked List – Reorder List
Problem: Given a singly linked list , reorder it in such a way that the first and last elements are next to each other , the second and second from last are next to each other etc. For example, Given the list [1,2,3,4,5] Reorder it into: [1,5,2,4,3] As you see we are merging elements from…