Given a Doubly Linked List, the task is to reverse the given Doubly Linked List. Example: Input: Output: Recommended Practice Reverse a Doubly Linked List… Read More
Category Archives: Linked List
Given an unsorted list of nodes. The task is to remove duplicates from the list. Examples: Input: linked list = 12->11->12->21->41->43->21 Output: 12->11->21->41->43. Explanation: Second occurrence o… Read More
Write a function that takes a list sorted in non-decreasing order and deletes any duplicate nodes from the list. The list should only be traversed… Read More
Given a linked list, print reverse of it using a recursive function. For example, if the given linked list is 1->2->3->4, then output should be… Read More
Write a GetNth() function that takes a linked list and an integer index and returns the data value stored in the node at that index… Read More
Write a GetNth() function that takes a linked list and an integer index and returns the data value stored in the node at that index… Read More
Write a GetNth() function that takes a linked list and an integer index and returns the data value stored in the node at that index… Read More
Write a GetNth() function that takes a linked list and an integer index and returns the data value stored in the node at that index… Read More
There are two singly linked lists in a system. By some programming error, the end node of one of the linked lists got linked to… Read More
Given a sorted linked list and a value to insert, write a function to insert the value in a sorted way.Initial Linked List Linked… Read More
Asked by Varun Bhatia. Question: Write a code for implementation of doubly linked list with use of single pointer in each node. Solution: This question… Read More
An example of linked list with a random pointerGiven a linked list of size N where each node has two links: one pointer points to… Read More
Asked by Varun Bhatia. Question: Write a recursive function treeToList(Node root) that takes an ordered binary tree and rearranges the internal pointers to make a… Read More
Given a singly linked list of characters, write a function that returns true if the given list is a palindrome, else false. Examples: Input:… Read More
Given a linked list, check if the linked list has a loop or not. The below diagram shows a linked list with a loop. Linked… Read More