filmov
tv
Permutations II | Two Approaches | Detailed | Recursion Concepts And Questions
![preview_player](https://i.ytimg.com/vi/Vd2YizhbN74/maxresdefault.jpg)
Показать описание
This is the 16th video of our playlist "Recursion Concepts And Questions". Find the Details below :
Video Name : Permutations II | Two Approaches | Recursion Concepts And Questions
Video # : 16
🔍 Unraveling Recursion: A Journey into the Depths of Code
🎥 Welcome to the 16th Video of my Recursion Playlist! 🚀 In this enlightening video, we will solve another very famous recursion/backtracking problem "Permutations II". We will start with a Simple story as well as Tree Diagram for understanding the problem 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 🌐. We will be solving it using the same approach as the Permutations I with slight enhancement to handle duplicate cases.
🔍 What's Inside?
🔗 Simple story understanding with Tree Diagram
🔗 Converting Story to code and writing the recursive code for Permutations II problem
🔗 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!
Approach Summary :
Approach-1 (Using same concept as Permutation-I but keeping count to avoid duplicates):
This approach employs backtracking to generate unique permutations of a given set of numbers. The algorithm maintains a count of the occurrences of each number using an unordered map. It iterates through the map, choosing each number and recursively exploring permutations while updating counts. This ensures duplicates are avoided by keeping track of the count of each number. The time complexity is O(N * N!), where N is the number of elements in the input array, and the space complexity is O(N).
Approach-2 (Using swap technique but avoiding duplicates by using set):
This approach utilizes the swap technique for generating permutations while preventing duplicates using a set to track unique elements. The algorithm recursively swaps elements at different positions and skips duplicates by checking against a set. This ensures that each permutation is unique. The time complexity is O(N * N!) in the worst case, where N is the number of elements in the input array, and the space complexity is O(N). The set is used to store unique elements during the recursive process.
╔═╦╗╔╦╗╔═╦═╦╦╦╦╗╔═╗
║╚╣║║║╚╣╚╣╔╣╔╣║╚╣═╣
╠╗║╚╝║║╠╗║╚╣║║║║║═╣
╚═╩══╩═╩═╩═╩╝╚╩═╩═╝
00:00 - Introduction
00:10 - Motivation (Bhashan)
01:45 - Problem Explanation
03:03 - Recall Permutation-I Approach-1
08:00 - Why it fails for Permutations-II
09:49 - Correcting Approach-1 for Permutations-II
15:37 - Coding Approach-1
19:20 - Time & Space Complexity
21:47 - Recall Permutation-I Approach-2
26:26 - Why it fails for Permutations-II
29:52 - Correcting Approach-2 for Permutations-II
35:35 - Coding Approach-2
39:34 - Time & 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
Video Name : Permutations II | Two Approaches | Recursion Concepts And Questions
Video # : 16
🔍 Unraveling Recursion: A Journey into the Depths of Code
🎥 Welcome to the 16th Video of my Recursion Playlist! 🚀 In this enlightening video, we will solve another very famous recursion/backtracking problem "Permutations II". We will start with a Simple story as well as Tree Diagram for understanding the problem 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 🌐. We will be solving it using the same approach as the Permutations I with slight enhancement to handle duplicate cases.
🔍 What's Inside?
🔗 Simple story understanding with Tree Diagram
🔗 Converting Story to code and writing the recursive code for Permutations II problem
🔗 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!
Approach Summary :
Approach-1 (Using same concept as Permutation-I but keeping count to avoid duplicates):
This approach employs backtracking to generate unique permutations of a given set of numbers. The algorithm maintains a count of the occurrences of each number using an unordered map. It iterates through the map, choosing each number and recursively exploring permutations while updating counts. This ensures duplicates are avoided by keeping track of the count of each number. The time complexity is O(N * N!), where N is the number of elements in the input array, and the space complexity is O(N).
Approach-2 (Using swap technique but avoiding duplicates by using set):
This approach utilizes the swap technique for generating permutations while preventing duplicates using a set to track unique elements. The algorithm recursively swaps elements at different positions and skips duplicates by checking against a set. This ensures that each permutation is unique. The time complexity is O(N * N!) in the worst case, where N is the number of elements in the input array, and the space complexity is O(N). The set is used to store unique elements during the recursive process.
╔═╦╗╔╦╗╔═╦═╦╦╦╦╗╔═╗
║╚╣║║║╚╣╚╣╔╣╔╣║╚╣═╣
╠╗║╚╝║║╠╗║╚╣║║║║║═╣
╚═╩══╩═╩═╩═╩╝╚╩═╩═╝
00:00 - Introduction
00:10 - Motivation (Bhashan)
01:45 - Problem Explanation
03:03 - Recall Permutation-I Approach-1
08:00 - Why it fails for Permutations-II
09:49 - Correcting Approach-1 for Permutations-II
15:37 - Coding Approach-1
19:20 - Time & Space Complexity
21:47 - Recall Permutation-I Approach-2
26:26 - Why it fails for Permutations-II
29:52 - Correcting Approach-2 for Permutations-II
35:35 - Coding Approach-2
39:34 - Time & 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
Комментарии