## Merge K Sorted Linked Lists

Merge K sorted linked lists problem is so famous as per the interview point of view. This question asks so many times in big companies like Google, Microsoft, Amazon, etc.  As the name suggests we’ve been provided with k sorted linked lists. We have to merge them together into a …

## Merge Two Sorted Linked Lists

In merge two sorted linked lists we have given head pointer of two linked lists, merge them such that a single linked list is obtained which has nodes with values in sorted order. return the head pointer of the merged linked list. Note: merge the linked list in-place without using …

## Merge Two Sorted Lists Leetcode

What is merge two sorted lists problem on leetcode? This is so interesting question asked so many times in compnies like Amazon, Oracle, Microsoft, etc. In this problem(Merge Two Sorted Lists Leetcode), we have given two linked lists. Both linked lists are in increasing order. Merge both linked list in …

## Reverse Nodes in K-Group

Problem In Reverse Nodes in K-Group problem we have given a linked list, Reverse the linked list in a group of k and return the modified list. If the nodes are not multiple of k then reverse the remaining nodes. The value of k is always smaller or equal to …

Add two numbers is a problem in which we have given two non-empty linked list representing a non-negative integer. The digit are store in reverse order and every node must contain only a single digit. Add the two numbers and print the result by using a linked list. Input Format …

## Insert Node in the Sorted Linked List

Insert a new node in the sorted linked list in sorted way After inserting a node in sorted linked list the final linked list should be the sorted linked list. Example Algorithm a. If linked list is empty linked list, then make the node as head and return it. b. …

## Detect a loop in the Linked List

In the given linked list, find whether there is loop or not If there is a loop in the linked list then some node in the linked list will be pointing to one of the previous nodes in the same linked list. Example Time complexity : O(n) Algorithm We use …

## Find Nth Node

In the given linked list find nth node. The function should return the data value in the nth node. n is input integer index. Example Time complexity : O(n) Algorithm 1. Initialize count equal to 0. 2. Traverse in the linked list.         a. If count is equal to the input …

## Swap nodes in the linked list

We are given a linked list and two key values, we need to swap these nodes. Example Time complexity : O(n) Algorithm We need to handle these cases, a. x and/or y may not present in the linked list. b. x or y may be last node. c. x or …