Lucidd8
Lucidd8
  • Видео 97
  • Просмотров 17 315
Same Tree - C++ Solution Explained In Hindi
Welcome to my channel! In this video, we’ll solve the "Same Tree" problem using C++. This is a fundamental LeetCode question that helps you understand tree structure comparison and recursive problem-solving, commonly tested in coding interviews.
We’ll break down the problem statement, explain a recursive approach to determine if two trees are the same, analyze time and space complexity, and provide a detailed C++ solution. Whether you're preparing for interviews or honing your skills in recursion, this video is for you!
Topics Covered:
Problem Understanding
Recursive Approach for Tree Comparison
Base Cases and Edge Cases Explained
C++ Code Example
Time and Space Complexity Analysis
Tips for Codin...
Просмотров: 20

Видео

Lecture 13 - Convert CFG to GNF Explained | UNIT - 3 | SPPU | TOC SERIES
Просмотров 41328 дней назад
In this lecture, we focus on converting a Context-Free Grammar (CFG) into Greibach Normal Form (GNF). This transformation is a crucial step in computational theory, simplifying grammar to ensure that every production starts with a terminal symbol, aiding in parsing and language processing. 🌟 What You'll Learn: The definition and properties of Greibach Normal Form (GNF) The step-by-step procedur...
Lecture 20 - Design Turing Machine For 2's Complement | UNIT-5 | SPPU | TOC SERIES
Просмотров 615Месяц назад
In this lecture, we explore the design of a Turing Machine to compute the 2's complement of a binary string. This builds on the concept of the 1's complement by adding a binary 1 to the least significant bit. This topic showcases the Turing Machine's ability to handle arithmetic-like operations. 🌟 What You'll Learn: The concept and significance of 2's complement in binary arithmetic Step-by-ste...
Lecture 19 - Design Turing Machine For 1's Complement | UNIT-5 | SPPU | TOC SERIES
Просмотров 258Месяц назад
In this lecture, we design a Turing Machine to compute the 1's complement of a binary string, where every 1 in the input is flipped to 0, and every 0 is flipped to 1. This problem illustrates the application of Turing Machines for simple data manipulation tasks. 🌟 What You'll Learn: The concept of 1's complement in binary systems Step-by-step design of a Turing Machine to transform a binary str...
Lecture 18 - Design Turing Machine For Language WcW | UNIT-5 | SPPU | TOC SERIES
Просмотров 210Месяц назад
In this lecture, we focus on designing a Turing Machine to recognize the language WcW WcW, where the string consists of a word W, followed by the character c, and then the same word W in the same order. This highlights the Turing Machine's ability to verify symmetry and patterns in strings. 🌟 What You'll Learn: Understanding the structure of the language WcW Designing a Turing Machine to compar...
Lecture 17 - Design Turing Machine That Accepts string with equal a's and b's|UNIT-5|SPPU|TOC SERIES
Просмотров 184Месяц назад
In this lecture, we design a Turing Machine that accepts strings containing an equal number of a's and b's, regardless of their order. This problem highlights the capabilities of Turing Machines to manage counting and balance checks in strings. 🌟 What You'll Learn: How to construct a Turing Machine to verify strings with equal a's and b's State transitions for pairing and eliminating characters...
Lecture 16 - Design Turing Machine For All Palindrome | Odd And Even | UNIT-5 | SPPU | TOC SERIES
Просмотров 163Месяц назад
In this lecture, we tackle the comprehensive task of designing a Turing Machine to recognize and accept all palindromes, whether of odd or even length. This is a significant step in automata theory, showcasing how Turing Machines handle symmetry and adapt to varying string lengths. 🌟 What You'll Learn: How to design a Turing Machine for recognizing both odd-length and even-length palindromes Un...
Lecture 15 - Design Turing Machine For Even Palindrome | UNIT-5 | SPPU | TOC SERIES
Просмотров 146Месяц назад
In this lecture, we design a Turing Machine to recognize and accept even-length palindromes, where the string reads the same forwards and backwards, with an even number of characters. This is an essential concept in automata theory, focusing on how Turing Machines can be used for detecting symmetrical patterns in strings. 🌟 What You'll Learn: How to design a Turing Machine to recognize even-len...
Lecture 14 - Design Turing Machine For Odd Palindrome | UNIT-5 | SPPU | TOC SERIES
Просмотров 152Месяц назад
In this lecture, we design a Turing Machine to recognize and accept odd-length palindromes, where the string reads the same forwards and backwards, with an odd number of characters. This is a crucial concept in automata theory, showcasing the power of Turing Machines to handle complex string patterns. 🌟 What You'll Learn: How to construct a Turing Machine for recognizing odd-length palindromes ...
Lecture 13 -Design Turing Machine To Accept Language Containing Substring 001|UNIT-5|SPPU|TOC SERIES
Просмотров 578Месяц назад
In this lecture, we focus on designing a Turing Machine that accepts a language containing the substring "001". This example demonstrates how Turing Machines can be used to detect specific substrings within a string, an important concept in pattern recognition and string manipulation. 🌟 What You'll Learn: How to design a Turing Machine to accept strings containing "001" Developing state transit...
Lecture 12 - Design Turing Machine For R = (aba*b) | UNIT - 5 | SPPU|TOC SERIES
Просмотров 839Месяц назад
In this lecture, we design a Turing Machine to recognize the language defined by the regular expression R = (aba*b), which consists of strings starting with "ab", followed by zero or more "a"s, and ending with a "b". This is a practical example of how Turing Machines can handle specific string patterns defined by regular expressions. 🌟 What You'll Learn: How to construct a Turing Machine for th...
Lecture 11 - Design Turing Machine to check well formation of strings | UNIT - 5 | SPPU|TOC SERIES
Просмотров 502Месяц назад
In this lecture, we focus on designing a Turing Machine to verify the well-formation of strings based on specific rules, such as matching parentheses, proper nesting, or other structural constraints. This topic demonstrates how Turing Machines handle complex string validation tasks systematically. 🌟 What You'll Learn: How to design a Turing Machine to check well-formed strings Understanding wel...
Lecture 10 - Design Turing Machine which replaces substring 101 with 110| UNIT - 5 | SPPU|TOC SERIES
Просмотров 636Месяц назад
In this lecture, we design a Turing Machine that scans a string on its tape and replaces every occurrence of the substring "101" with "110". This example highlights how Turing Machines are used for string manipulation tasks. 🌟 What You'll Learn: How to construct a Turing Machine for substring replacement Developing state transitions to identify "101" and replace it with "110" Managing the tape ...
Lecture 9 - Design Turing Machine For Language ending with 10 | UNIT - 5 | SPPU | TOC SERIES
Просмотров 339Месяц назад
In this lecture, we focus on designing a Turing Machine to recognize strings that end with the substring "10". This topic demonstrates the ability of Turing Machines to process and identify specific patterns in strings effectively. 🌟 What You'll Learn: How to construct a Turing Machine to identify strings ending with "10" Designing transition functions to detect patterns while scanning the tape...
Lecture 8 - Design Turing Machine to Multiply 2 Unary Numbers | UNIT - 5 | SPPU | TOC SERIES
Просмотров 939Месяц назад
In this lecture, we design a Turing Machine to perform multiplication on two unary numbers, where numbers are expressed as repeated symbols (e.g., sequences of 1's). This problem illustrates the computational power of Turing Machines in executing arithmetic operations. 🌟 What You'll Learn: How to construct a Turing Machine for unary multiplication Logic and transitions for iteratively adding on...
Lecture 7 - Design Turing Machine to Add 2 Unary Numbers | UNIT - 5 | SPPU | TOC SERIES
Просмотров 323Месяц назад
Lecture 7 - Design Turing Machine to Add 2 Unary Numbers | UNIT - 5 | SPPU | TOC SERIES
Lecture 6 - Design Turing Machine to Subtract 2 Unary Numbers | UNIT - 5 | SPPU | TOC SERIES
Просмотров 451Месяц назад
Lecture 6 - Design Turing Machine to Subtract 2 Unary Numbers | UNIT - 5 | SPPU | TOC SERIES
Lecture 5 - Design Turing Machine For Language having even no. 0s and 1s | UNIT - 5 |SPPU|TOC SERIES
Просмотров 304Месяц назад
Lecture 5 - Design Turing Machine For Language having even no. 0s and 1s | UNIT - 5 |SPPU|TOC SERIES
Lecture 4 - Design Turing Machine For Language a^i b^j i is less than j|UNIT - 5 | SPPU | TOC SERIES
Просмотров 328Месяц назад
Lecture 4 - Design Turing Machine For Language a^i b^j i is less than j|UNIT - 5 | SPPU | TOC SERIES
Lecture 3 - Design Turing Machine For Language a^n b^n c^n | UNIT - 5 | SPPU | TOC SERIES
Просмотров 258Месяц назад
Lecture 3 - Design Turing Machine For Language a^n b^n c^n | UNIT - 5 | SPPU | TOC SERIES
Lecture 2 - Design Turing Machine For 0^n 1^n | UNIT - 5 | SPPU | TOC SERIES
Просмотров 331Месяц назад
Lecture 2 - Design Turing Machine For 0^n 1^n | UNIT - 5 | SPPU | TOC SERIES
Lecture 1 - Introduction to Turing Machine | UNIT - 5 | SPPU | TOC SERIES
Просмотров 454Месяц назад
Lecture 1 - Introduction to Turing Machine | UNIT - 5 | SPPU | TOC SERIES
Lecture 6 - CFL to CFG When w is a odd,even,odd or even length palindrome | UNIT - 3|SPPU|TOC SERIES
Просмотров 331Месяц назад
Lecture 6 - CFL to CFG When w is a odd,even,odd or even length palindrome | UNIT - 3|SPPU|TOC SERIES
Lecture 12 - Derivation and Derivation tree Explained| UNIT - 3|SPPU|TOC SERIES
Просмотров 201Месяц назад
Lecture 12 - Derivation and Derivation tree Explained| UNIT - 3|SPPU|TOC SERIES
Lecture 11 - Conversion of CFG into CNF Explained| UNIT - 3|SPPU|TOC SERIES
Просмотров 334Месяц назад
Lecture 11 - Conversion of CFG into CNF Explained| UNIT - 3|SPPU|TOC SERIES
Lecture 9 - Conversion of CFG to PDA Explained | UNIT - 4 |SPPU|TOC SERIES
Просмотров 462Месяц назад
Lecture 9 - Conversion of CFG to PDA Explained | UNIT - 4 |SPPU|TOC SERIES
Lecture 8 - a^n+m b^m c^n Push, Pop, Nop Operations Expalined| UNIT - 4|SPPU|TOC SERIES
Просмотров 184Месяц назад
Lecture 8 - a^n m b^m c^n Push, Pop, Nop Operations Expalined| UNIT - 4|SPPU|TOC SERIES
Lecture 7 - a^i b^j c^k i + j = k Push, Pop, Nop Operations Expalined| UNIT - 4|SPPU|TOC SERIES
Просмотров 144Месяц назад
Lecture 7 - a^i b^j c^k i j = k Push, Pop, Nop Operations Expalined| UNIT - 4|SPPU|TOC SERIES
Lecture 6 - WaW^r WbW^r odd palindrome Push, Pop, Nop Operations Expalined| UNIT - 4|SPPU|TOC SERIES
Просмотров 175Месяц назад
Lecture 6 - WaW^r WbW^r odd palindrome Push, Pop, Nop Operations Expalined| UNIT - 4|SPPU|TOC SERIES
Lecture 5 - WW^r Even palindrome Push, Pop, Nop Operations Expalined| UNIT - 4 | SPPU | TOC SERIES
Просмотров 189Месяц назад
Lecture 5 - WW^r Even palindrome Push, Pop, Nop Operations Expalined| UNIT - 4 | SPPU | TOC SERIES

Комментарии

  • @abhijeetingle6209
    @abhijeetingle6209 15 дней назад

    Finally dsa series is back

    • @Lucidd8
      @Lucidd8 15 дней назад

      Yup it is

  • @ashiyashaikh5275
    @ashiyashaikh5275 20 дней назад

  • @mayankkhetan702
    @mayankkhetan702 23 дня назад

    nice explanation

  • @paarthjagga7287
    @paarthjagga7287 23 дня назад

    in exam if our turing machine logic is correct and machine is correctly drawn but the effectiveness of the machine isnt the baest possible i.e. more number of states were used than minimum possible, will it be considered? and if yes will we get full marks for the answer?

  • @beown5841
    @beown5841 23 дня назад

    very nice, can you provide notes pdf? please. tomorrow 10 am exam

    • @Lucidd8
      @Lucidd8 23 дня назад

      t.me/study_metarial_Engg/351/1538?single You can visit this channel for notes

  • @respect-editz6918
    @respect-editz6918 23 дня назад

    Completely understood 😮

  • @pritiladda8740
    @pritiladda8740 23 дня назад

    Bhai isse simple explanation main aaj tak nai dekha or samjh bhi Aya 😊

  • @billionairedreams583
    @billionairedreams583 23 дня назад

    bro... you are best...!!!! respect!!!!!!!!!

  • @GB-wj2qm
    @GB-wj2qm 23 дня назад

    Thanks✨

  • @manjeetchoudhary6996
    @manjeetchoudhary6996 24 дня назад

    love you brother thanks a lot

  • @gubluthebunny189
    @gubluthebunny189 24 дня назад

    Kuch bhi sikhata

    • @Lucidd8
      @Lucidd8 24 дня назад

      I tried my best

  • @VivekSharma-eh2tv
    @VivekSharma-eh2tv 25 дней назад

    thanks vhai

  • @kunalpatil4916
    @kunalpatil4916 26 дней назад

    Bhai important questions bata do

    • @Lucidd8
      @Lucidd8 24 дня назад

      t.me/study_metarial_Engg/351/1538?single Refer this for unit 3, 4, 5 seperated pyqs

  • @kunalpatil4916
    @kunalpatil4916 26 дней назад

    Bhai imp de do

  • @anishdawkhar2013
    @anishdawkhar2013 27 дней назад

    Sir please made video on urgent basis of question: Design a Turning Machine which replaces substring 110 by 101

  • @chupbeth
    @chupbeth 27 дней назад

    feedback - jara dhire bolo while explaining you should explain rules first baki sb good he bhai best of luck

    • @Lucidd8
      @Lucidd8 24 дня назад

      Thank you for your feedback

  • @babajisonawane4414
    @babajisonawane4414 27 дней назад

    Sir please make video for this question Design a Turing machine to recognise an arbitrary string divisible by 4, given input(0,1,2)

  • @manindersingh-zn6zz
    @manindersingh-zn6zz 28 дней назад

    bdiaa videos hai apki.... keep it up

    • @Lucidd8
      @Lucidd8 28 дней назад

      Thank you

  • @GodsEmperor15
    @GodsEmperor15 28 дней назад

    How we would know that which characters we have to push, which have to skip and which have to pop?

    • @Lucidd8
      @Lucidd8 28 дней назад

      in the context of this question we can know that the starting a's and ending a's frequency is same for which the logic would be as same as a^n b^n as both this character has same frequency now for the middle character b the frequency of b depends on the value m and as it is at middle and after making sure we will have at least one b we will do the furthur process that is skipping b's and that is why pushing the initial a's then skipping the b's and poping a's will be the logic to design pda for this language the push pop and skip logic will be different for different problems

    • @GodsEmperor15
      @GodsEmperor15 28 дней назад

      @Lucidd8 now I got it thanks!

  • @rushikeshpatil1986
    @rushikeshpatil1986 28 дней назад

    aswm🤌

  • @vicky-negii
    @vicky-negii 29 дней назад

    Hii, are you a college student? if yes, in which sem you are?

    • @Lucidd8
      @Lucidd8 29 дней назад

      Yes, and currently i am in 5th semester

  • @HarishBhong
    @HarishBhong 29 дней назад

    can we add this transition function: ( q1, b, b) = ( q1, epsilon)

    • @lazii8173
      @lazii8173 29 дней назад

      No we can't as we are pushing all the occurrences of a's into the stack and then poping those a's when we read b and then change the state to q2 such that we will pop a's from the stack when we read c so we never pushed b into stack and hence we cannot add this transition function

  • @agrimgupta0805
    @agrimgupta0805 29 дней назад

    thanks sir

    • @Lucidd8
      @Lucidd8 29 дней назад

      If you liked it, please do share the video

  • @tejaskahar3697
    @tejaskahar3697 29 дней назад

    Bhai playlist ko pls sequence se lagao Btw video acchi se samaj raha hai

    • @Lucidd8
      @Lucidd8 29 дней назад

      Thanks for the feedback, sure we will do that

  • @GodsEmperor15
    @GodsEmperor15 29 дней назад

    Underatted channel....

  • @kanishkmehto-cv9ld
    @kanishkmehto-cv9ld 29 дней назад

    thanks could u complete rest of series faster too pls?

    • @Lucidd8
      @Lucidd8 29 дней назад

      Some topics are remaining such as cyk algo and ambigous grammar which I won't be uploading videos of and also pda to cfg topic from unit 4.

  • @MuggleMonk-rc4md
    @MuggleMonk-rc4md 29 дней назад

    how many videos will be there for unit 3 ?

    • @Lucidd8
      @Lucidd8 29 дней назад

      Mostly one more on cfg to gnf

  • @sagarkadam13
    @sagarkadam13 Месяц назад

    Sir please upload unit ,6

    • @Lucidd8
      @Lucidd8 29 дней назад

      I won't be uploading unit 6

  • @kanishkmehto-cv9ld
    @kanishkmehto-cv9ld Месяц назад

    very helpful

  • @TS-yf2sq
    @TS-yf2sq Месяц назад

    Best explanation

    • @Lucidd8
      @Lucidd8 Месяц назад

      Thanks mate

  • @IAMSHOOTXPRO
    @IAMSHOOTXPRO Месяц назад

    finally understood , thanks bro

    • @Lucidd8
      @Lucidd8 Месяц назад

      My Pleasure

  • @_status_304_8
    @_status_304_8 Месяц назад

    bro kab tak complete hoga full syllabus or unit 4...

    • @Lucidd8
      @Lucidd8 Месяц назад

      Before 5th unit 3, 4, 5 ke videos aajayege

  • @abhijeetingle6209
    @abhijeetingle6209 Месяц назад

    Thank you bhai for this video series ,plz upload all unit video sooner ..

    • @Lucidd8
      @Lucidd8 Месяц назад

      vahi plan hai bhai

  • @BALAGANESHCACSE
    @BALAGANESHCACSE Месяц назад

    try to explain in english

    • @Lucidd8
      @Lucidd8 Месяц назад

      It is a Hindi channel but in future i will try to explain in videos in English

  • @shootxpro5404
    @shootxpro5404 Месяц назад

  • @AryanSharma-pk5zl
    @AryanSharma-pk5zl Месяц назад

    for student like me this video is must helpful thankyou bhai keep going god bless you with lots of love & successes

    • @Lucidd8
      @Lucidd8 Месяц назад

      thank you bhai

  • @vaibhavjadhav7862
    @vaibhavjadhav7862 Месяц назад

    If i want length of middle word, what syntax will run?

    • @abhijeetingle6209
      @abhijeetingle6209 Месяц назад

      public class MiddleWordLength { public static void main(String[] args) { String sentence = "This is a sample sentence"; // Split the sentence into words String[] words = sentence.split(" "); // Find the middle word int middleIndex = words.length / 2; String middleWord = words[middleIndex]; // Get the length of the middle word int lengthOfMiddleWord = middleWord.length(); // Print the result System.out.println("Length of the middle word: " + lengthOfMiddleWord); } }

  • @abhijeetingle6209
    @abhijeetingle6209 Месяц назад

    very nicely Explained bro..

    • @Lucidd8
      @Lucidd8 Месяц назад

      Thank you 🙂

  • @pacmaysmedia
    @pacmaysmedia Месяц назад

    Nice

  • @shootxpro5404
    @shootxpro5404 Месяц назад

    🤩🤩 you really inspire me to code plz do upload videos daily ..

    • @Lucidd8
      @Lucidd8 Месяц назад

      Sure 😊

  • @abhijeetingle6209
    @abhijeetingle6209 Месяц назад

    ❤❤❤

  • @pacmaysmedia
    @pacmaysmedia 2 месяца назад

    👏🏼

  • @Lucidd8
    @Lucidd8 2 месяца назад

    class Solution { private: int h(int i, int j, vector<vector<int>>&dp){ if(i == 0 || j == 0) return 1; if(dp[i][j] != -1) return dp[i][j]; return dp[i][j] = h(i - 1, j, dp) + h(i, j - 1, dp); } public: int uniquePaths(int m, int n) { vector<vector<int>>dp(m + 1, vector<int>(n + 1, -1)); return h(m - 1, n - 1, dp); } }; OR class Solution { private: int h(int i, int j, int m, int n, vector<vector<int>>& dp) { if (i == m - 1 || j == n - 1) return 1; if (dp[i][j] != -1) return dp[i][j]; return dp[i][j] = h(i + 1, j, m, n, dp) + h(i, j + 1, m, n, dp); } public: int uniquePaths(int m, int n) { vector<vector<int>> dp(m + 1, vector<int>(n + 1, -1)); return h(0, 0, m, n, dp); } };

  • @Lucidd8
    @Lucidd8 2 месяца назад

    C++ : class Solution { public: bool rotateString(string s, string goal) { for(int i = 0;i < s.size();i++){ char c = s[0]; s.erase(0, 1); s.push_back(c); if(s == goal) return true; } return false; } }; JAVA : class Solution { public boolean rotateString(String s, String goal) { for (int i = 0; i < s.length(); i++) { char c = s.charAt(0); s = s.substring(1) + c; if (s.equals(goal)) { return true; } } return false; } } PYTHON : class Solution: def rotateString(self, s: str, goal: str) -> bool: for i in range(len(s)): s = s[1:] + s[0] if s == goal: return True return False

    • @shootxpro5404
      @shootxpro5404 2 месяца назад

      bhai ye har videos mai dala koro .. thanks for the code

    • @Lucidd8
      @Lucidd8 2 месяца назад

      @@shootxpro5404 okay bro dyan rakhunga

  • @IAMSHOOTXPRO
    @IAMSHOOTXPRO 2 месяца назад

    nicely explained bhai, do make more such videos

    • @Lucidd8
      @Lucidd8 2 месяца назад

      Thanks bhai aache se samjane ka try karta rahunga

  • @abhijeetingle6209
    @abhijeetingle6209 2 месяца назад

    We need such videos❤❤

    • @Lucidd8
      @Lucidd8 2 месяца назад

      Thank you man stay subscribed i will bring more such videos in future

  • @arpitsharma3127
    @arpitsharma3127 2 месяца назад

    Bahut sahi bhai daily dalte raho

    • @Lucidd8
      @Lucidd8 2 месяца назад

      Vahi plan hai bro and thank you it means a lot

  • @lazii8173
    @lazii8173 2 месяца назад

    There is a lot of room for improvement Keep it up and thanks ye video dekh kar aache se concept samaj aagaya

    • @Lucidd8
      @Lucidd8 2 месяца назад

      Thank You for the feedback i am trying to explain it better

  • @abhijeetingle6209
    @abhijeetingle6209 2 месяца назад

    ❤‍🔥❤‍🔥❤‍🔥❤‍🔥

    • @Lucidd8
      @Lucidd8 2 месяца назад

      Thank You Bro