Palindrome Linked List Leetcode Solution

In the problem “Palindrome Linked List”, we have to check whether a given singly integer linked list is a palindrome or not. Example List = {1 -> 2 -> 3 -> 2 -> 1} true Explanation #1: The list is palindrome as all elements from the start and back are …

Read morePalindrome Linked List Leetcode Solution

Merge Two Sorted Lists Leetcode Solutions

Linked lists are quite like arrays in their linear properties. We can merge two sorted arrays to form an overall sorted array. In this problem, we have to merge two sorted linked lists in place to return a new list which contains elements of both lists in a sorted fashion. Example …

Read moreMerge Two Sorted Lists Leetcode Solutions

Union and Intersection of two Linked Lists

Given two linked lists, create another two linked lists to get union and intersection of the elements of existing lists. Example Input: List1: 5 → 9 → 10 → 12 → 14 List2: 3 → 5 → 9 → 14 → 21 Output: Intersection_list: 14 → 9 → 5 Union_list:   …

Read moreUnion and Intersection of two Linked Lists

Write a function to get the intersection point of two Linked Lists

Problem Statement The problem “Write a function to get the intersection point of two Linked Lists” states that you are given two linked lists. But they are not independent linked lists. They are connected at some point. Now you need to find this point of intersection of these two lists. …

Read moreWrite a function to get the intersection point of two Linked Lists

Delete Nth node from the end of the given linked list

Problem Statement The problem “Delete Nth node from the end of the given linked list”  states that you are given a linked list with some nodes. And now you need to remove nth node from the end of the linked list. Example 2->3->4->5->6->7 delete 3rd node from last 2->3->4->6->7 Explanation: …

Read moreDelete Nth node from the end of the given linked list

Delete a Node from linked list without head pointer

Problem Statement The problem “Delete a Node from linked list without head pointer” states that you have a linked list with some nodes. Now you want to delete a node but you don’t have its parent node address. So delete this node. Example 2->3->4->5->6->7 Node to be deleted: 4 2->3->5->6->7 …

Read moreDelete a Node from linked list without head pointer

Implementation of Deque using Doubly Linked List

Problem Statement The problem “Implementation of Deque using Doubly Linked List” states that you need to implement the following functions of Deque or Doubly Ended Queue using a doubly linked list, insertFront(x) : Add element x at the starting of Deque insertEnd(x) : Add element x at the end of …

Read moreImplementation of Deque using Doubly Linked List