Let us initialize first and last nodes of three linked lists 1 ) Linked list of values smaller than x . 2 ) Linked list of values equal to x . 3 ) Linked list of values greater than x .
struct Node * smallerHead = NULL , * smallerLast = NULL ; struct Node * greaterLast = NULL , * greaterHead = NULL ; struct Node * equalHead = NULL , * equalLast = NULL ;