## Count rotations in sorted and rotated linked list

Given a linked list of n nodes which is first sorted, then rotated by k elements. Find the value of k. Recommended: Please try your… Read More »

Quick Links for Linked List

Quizzes |

Videos on Linked List |

Given a linked list of n nodes which is first sorted, then rotated by k elements. Find the value of k. Recommended: Please try your… Read More »

Given a singly linked list, we have to convert it into circular linked list. For example, we have been given a singly linked list with… Read More »

Given a Linked List of length n and block length k rotate in circular manner towards right/left each block by a number d. If d… Read More »

There are n people standing in a circle waiting to be executed. The counting out begins at some point in the circle and proceeds around… Read More »

Insert a node x after the nth node from the end in the given singly linked list. It is guaranteed that the list contains the… Read More »

Given a linked list of 0s, 1s and 2s, sort it. Examples: Input : 2->1->2->1->1->2->0->1->0 Output : 0->0->1->1->1->1->2->2->2 Input : 2->1->0 Output : 0->1->2 Recommended:… Read More »

Given two sorted lists, merge them so as to produce a combined sorted list (without using extra space). Examples: Input : head1: 5->7->9 head2: 4->6->8… Read More »

Given a linked list containing n nodes. The problem is to insert a new node with data x at the middle of the list. If… Read More »

Given a matrix. Convert it into a linked list matrix such that each node is connected to its next right and down node. Example: Input… Read More »

Given a singly linked list and a number k, find the last node whose n%k == 0, where n is the number of nodes in… Read More »

Given a singly linked list and a number k, write a function to find the (n/k)-th element, where n is the number of elements in… Read More »

Given a linked list, write a function to reverse every k nodes (where k is an input to the function). Examples: Inputs: 1->2->3->4->5->6->7->8->NULL and k… Read More »

Given a circular linked list, count number of nodes in it. For example output is 5 for below list. Recommended: Please try your approach on… Read More »

Write a function detectAndCountLoop() that checks whether a given Linked List contains loop and if loop is present then returns count of nodes in loop.… Read More »

We are given a linked list, we need to print the linked list in reverse order. Examples: Input : list : 5-> 15-> 20-> 25… Read More »