Skip to content

Category Archives: Linked List

Given a singly linked list, swap kth node from beginning with kth node from end. Swapping of data is not allowed, only pointers should be… Read More
Following is a typical recursive implementation of QuickSort for arrays. The implementation uses last element as pivot.  C++ /* A typical recursive implementation of Quicksort… Read More
Given a Binary Tree (Bt), convert it to a Doubly Linked List(DLL). The left and right pointers in nodes are to be used as previous… Read More
  Given a Linked List, the task is to insert a new node in this given Linked List at the following positions:  At the front… Read More
Linked List is a linear data structure, in which elements are not stored at a contiguous location, rather they are linked using pointers. Linked List… Read More
Given a linked list where in addition to the next pointer, each node has a child pointer, which may or may not point to a… Read More
Given a linked list of 0s, 1s and 2s, The task is to sort and print it. Examples:  Input: 1 -> 1 -> 2 ->… Read More
Given two numbers represented by two linked lists, write a function that returns the sum of the two linked lists in the form of a… Read More
Given a linked list where every node represents a linked list and contains two pointers of its type:  Pointer to next node in the main… Read More
Given a singly linked list, The task is to rotate the linked list counter-clockwise by k nodes. Examples: Input: linked list = 10->20->30->40->50->60, k =… Read More
Given three linked lists, say a, b and c, find one node from each list such that the sum of the values of the nodes… Read More
In the previous post, we discussed how a Doubly Linked can be created using only one space for the address field with every node. In… Read More
Given two Linked Lists, create union and intersection lists that contain union and intersection of the elements present in the given lists. The order of… Read More
Given a Doubly Linked List which has data members sorted in ascending order. Construct a Balanced Binary Search Tree which has same data members as… Read More
Given a Singly Linked List which has data members sorted in ascending order. Construct a Balanced Binary Search Tree which has same data members as… Read More