Flattening a Linked List | Magic Of Recursion | Recursion Concepts And Questions | Video 13

Subscribers:
92,300
Published on ● Video Link: https://www.youtube.com/watch?v=Q05ZTiqgBtw



Duration: 22:58
571 views
49


iPad PDF Notes - https://github.com/MAZHARMIK/Interview_DS_Algo/blob/master/iPad%20PDF%20Notes/Recursion%20Concepts%20%26%20Qns%20-%2013.pdf
Whatsapp Community Link : https://www.whatsapp.com/channel/0029Va6kVSjICVfiVdsHgi1A
This is the 13th video of our playlist "Recursion Concepts And Questions". Find the Details below :

Similar Qn and using the same code of "Merge Two Sorted Lists" - Leetcode-21- Video Link - https://www.youtube.com/watch?v=RreHsOfi14w

Video Name : Flattening a Linked List | Magic Of Recursion | Recursion Concepts And Questions
Video # : 13
C++/Java Code Link : https://github.com/MAZHARMIK/Interview_DS_Algo/blob/master/Linked%20List/Flattening%20a%20Linked%20List.cpp
GfG Problem Link : https://www.geeksforgeeks.org/problems/flattening-a-linked-list/1


πŸ” Unraveling Recursion: A Journey into the Depths of Code

πŸŽ₯ Welcome to the 13th Video of my Recursion Playlist! πŸš€ In this enlightening video, we will solve a very famous recursion problem "Flattening a Linked List" with the help of Recursion. This is a particular type of recursion problem "Flattening Questions". We will start with a Simple story understanding the problem by making a simple tree Diagram and then we will be Converting Story to code and writing the recursive code for the problem and also I will also be explaining the Time and Space Complexity of the code 🌐

πŸ” What's Inside?

πŸ”— Simple story understanding with Choice Tree Diagram

πŸ”— Converting Story to code and writing the recursive code for Flattening a Linked List

πŸ”— Explanation of Time and Space Complexity of the code

πŸ‘©β€πŸ’» Who Should Watch?

This playlist is for everyone but best suited for Freshers who are new to Recursion.

πŸš€ Embark on the Recursive Adventure Now!

My DP Concepts Playlist : https://youtu.be/7eLMOE1jnls
My Graph Concepts Playlist : https://youtu.be/5JGiZnr6B5w
My GitHub Repo for interview preparation : https://github.com/MAZHARMIK/Interview_DS_Algo
Subscribe to my channel : https://www.youtube.com/@codestorywithMIK
Instagram : https://www.instagram.com/codestorywithmik/
Facebook : https://www.facebook.com/people/codestorywithmik/100090524295846/
Twitter : https://twitter.com/CSwithMIK


Approach Summary : The provided code implements a function to merge two linked lists in sorted order, and another function to flatten a linked list of linked lists. The mergeTwoLists function takes two sorted linked lists (head1 and head2) and merges them into a single sorted linked list. It uses a recursive approach, comparing the nodes of the input lists and merging them accordingly. The flatten function is designed to flatten a linked list of linked lists. It recursively flattens the remaining linked lists after the current one (temp) and then merges the current linked list (head) with the flattened result using the mergeTwoLists function. The final result is a single sorted linked list containing all the elements from the original linked lists. Overall, this code demonstrates a recursive approach to merge sorted linked lists and flatten a linked list of linked lists while maintaining the sorted order.

╔═╦╗╔╦╗╔═╦═╦╦╦╦╗╔═╗
β•‘β•šβ•£β•‘β•‘β•‘β•šβ•£β•šβ•£β•”β•£β•”β•£β•‘β•šβ•£β•β•£
β• β•—β•‘β•šβ•β•‘β•‘β• β•—β•‘β•šβ•£β•‘β•‘β•‘β•‘β•‘β•β•£
β•šβ•β•©β•β•β•©β•β•©β•β•©β•β•©β•β•šβ•©β•β•©β•β•

✨ Timelines✨
00:00 - Introduction
00:12 - Bhashan (Motivation)
01:36 - Problem Explanation
06:19 - Beauty Of Recursion
08:01 - Story to Code
11:02 - Merge two Sorted Lists
14:49 - Coding it up
18:21 - Time and Space Complexity


#codestorywithMIK
#coding #helpajobseeker #easyrecipes #leetcode #leetcodequestionandanswers #leetcodesolution #leetcodedailychallenge #leetcodequestions #leetcodechallenge #hindi #india #coding #helpajobseeker #easyrecipes #leetcode #leetcodequestionandanswers #leetcodesolution #leetcodedailychallenge #leetcodequestions #leetcodechallenge #hindi #india #hindiexplanation #hindiexplained #easyexplaination #interview#interviewtips #interviewpreparation #interview_ds_algo #hinglish #github #design #data #google #video #instagram #facebook #leetcode #computerscience #leetcodesolutions #leetcodequestionandanswers #code #learning #dsalgo #dsa #2024 #newyear #RecursionExplained #CodingJourney #Programming101 #TechTalks #AlgorithmMastery #Recursion #Programming #Algorithm #Code #ComputerScience #SoftwareDevelopment #CodingTips #RecursiveFunctions #TechExplained #ProgrammingConcepts #CodeTutorial #LearnToCode #TechEducation #DeveloperCommunity #RecursiveThinking #ProgrammingLogic #ProblemSolving #AlgorithmDesign #CSEducation




Other Videos By codestorywithMIK


2024-02-27Power Set | Same as Subsets | Magic Of Recursion | Recursion Concepts And Questions
2024-02-26Diameter of Binary Tree | Simple Story | Amazon | Leetcode 543
2024-02-26Earliest Second to Mark Indices I | Detailed Intuition | Leetcode Weekly Contest 386 | Leetcode 3048
2024-02-25Generate Parentheses | 2 Approaches | Magic Of Recursion | Recursion Concepts And Questions
2024-02-25Greatest Common Divisor Traversal | Why Graph | Why DSU | Google | Leetcode 2709
2024-02-24Find All People With Secret | 4 Approaches | Google | Leetcode 2092
2024-02-23Thank you and Love You All β€οΈπŸ™
2024-02-23N-Queens | 2 Approaches | Super Detailed | Magic Of Recursion | Recursion Concepts And Questions
2024-02-21Bitwise AND of Numbers Range | 2 Approaches | Dry Run | Leetcode 201
2024-02-19Missing Number | Multiple Approaches | Leetcode 268
2024-02-19Flattening a Linked List | Magic Of Recursion | Recursion Concepts And Questions | Video 13
2024-02-18Power of Two | Multiple Approaches | Leetcode 231
2024-02-18Meeting Rooms III | Detailed Intuition | Brute Force | Optimal | Leetcode 2402
2024-02-16Furthest Building You Can Reach | What is Lazy Greedy | Recursion | Memoization | Leetcode 1642
2024-02-16Flatten BST to sorted list | Magic Of Recursion | Recursion Concepts And Questions | Video 12
2024-02-16Least Number of Unique Integers after K Removals | 3 Approaches | Greedy | Leetcode 1481
2024-02-15Rat in a Maze Problem | Simple Story To Code | Recursion Concepts And Questions | Video 11
2024-02-14Find Polygon With the Largest Perimeter | Thought Process | Greedy | Leetcode 2971
2024-02-14Subsets | Simple Story To Code | Leetcode 78 | Recursion Concepts And Questions | Video 10
2024-02-13Rearrange Array Elements by Sign | 2 Approaches | Why Order Preserve | Leetcode 2149
2024-02-13Quick Sort | Simple Story | Story To Code | Recursion Concepts And Questions | Video 9