Tag Archives: linked list partitioning

Split The Linked List

Given a linked list and a number n. Split the link list into two based on the following pattern input: 1->2->3->4->5->6->7->8->null and n=2 output: 1-2->3->4->null and 5->6->7->8->null input: 2->3->1->4->6->7->7->6->null and n=4 output: 2-3->null and 1->4->6->7->7->6->null return the right partition pointer. First note that pattern. For n=2 it is effectively partitioning the list into two halves. […]