public static void Main()
LinkedList list = new LinkedList();
list.head.next = new Node(5);
list.head.next.next = new Node(10);
list.head.next.next.next = new Node(2);
list.head.next.next.next.next = new Node(8);
list.head.next.next.next.next.next = new Node(2);
list.head.next.next.next.next.next.next = new Node(1);
Console.WriteLine("Linked list before reversing:");
list.printAllNodes(list.head);
list.Partition(list.head,5);
Console.WriteLine("Linked list after Partition:");
list.printAllNodes(list.head);
public void printAllNodes(Node head)
Console.Write("{0} ",current.data);
public void Partition(Node head,int x)
Node dummy1=new Node(0), dummy2=new Node(0);
Node curr1=dummy1, curr2=dummy2;