• Courses
  • Tutorials
  • DSA
  • Data Science
  • Web Tech
November 05, 2024 |80 Views

PROBLEM OF THE DAY : 31/10/2024 | Insert in Sorted way in a Sorted DLL

Description
Discussion

Welcome to the daily solving of our PROBLEM OF THE DAY with Dev Vikram We will discuss the entire problem step-by-step and work towards developing an optimized solution. This will not only help you brush up on your concepts of Linked List but also build up problem-solving skills.

Given a sorted doubly linked list and an element x, you need to insert the element x into the correct position in the sorted Doubly linked list(DLL).

Note: The DLL is sorted in ascending order

Example:

Input: LinkedList: 3->5->8->10->12 , x = 9

Output: 3->5->8->9->10->12

Explanation: Here node 9 is inserted in the Doubly Linked-List.
 

Give the problem a try before going through the video. All the best!!!
Problem Link: https://practice.geeksforgeeks.org/problems/insert-in-sorted-way-in-a-sorted-dll/1