Brahmaji bole "coding kar lo , placement aa raha hai". You are the best teacher. The way you explain the complex concepts in simple manner, it is really amazing. Thanks a lot.
Haha, even if I am unable to reply to every comment on the channel. I make sure to read each and everyone of them !! So don't worry brother, your blessings and comments are reaching out to me. ❤️
Thank you very much for this video as you are the only one who explained why disk needs to move from source to helper first instead of making statement that it has to be moved. Thanks again for focussing on explaining the logic instead of memorize something.
Aditya... Man you have a great knack of storytelling and that's the reason why you teach so very well. Loved the story... Never have heard it before and the way you narrated it seriously I laughed for like whole of that story time 😂. Thanks a lot.
From a long time I couldn't able to understand this problem but I got confidence to solve problems similar like this... really improved my way of thinking of recursion
And then he said "to priest logo ne bola, "yaar ye thoda zyada ho rha hai par chalo okay"" Couldn't help laughing xDD Your content is so easy to understand :")
The best part about the video was the Bhrama story. I loved it. What an amazing story. I heard a story about where a Peasent goes to a King for some rice. So the King asks how much rice does he needs. The Peasent says he needs a single grain of rice for each square in a chess board. The only condition is that you have to double the rice of grain each time you go to a new square. The King was a fool so he agreed to the deal. 2^64 grain of rice is quite much. How much? Well as a proud/weird nerd I went to the internet to find the answer. As it turns out 2^64 grain of rice is roughly equivalent to a millennium(1000 years) of our entire plantes rice production. Yikes!!
Grate i don't have word to thank you Bro!! mene bhot sare videos dekhe par kisise bhi smj nai aaya even gate ki preparation m bhi sir ne pdaya lekin smj nai aaya but because of you I understood it very clearly !! thank you so much
this was never so easy to understand aditya bhaiya, you really meant it when you said you would convert us into jedis of recursion, thankyou for doing what you're doing!! :D
#include using namespace std; void toh(char s, char d, char a, int n) { if (n == 0) return; toh(s, a, d, n - 1); // move the n-1 discs from source to aux using destination rod cout
might be this story is correct but I am known to the fact that there is only one temple for brahma dev in entire world, and these has many reasons that are there in hindu mythlogy, one is he was cursed to have just one temple, and that is in pushkar, but the explanation was fabulous sir, no one can make it much easier
Exact same code in Java: import java.util.*; class Main { public static void main(String[] args) { Scanner scn = new Scanner(System.in); int n = scn.nextInt(); int s = 1, d = 2, h = 3; solve(n , s, d, h); } public static void solve(int n, int s, int d, int h){ if(n == 1){ System.out.println("Moving plate " + n + " from " + s + " to " + d); return; } solve(n - 1, s, h, d); System.out.println("Moving plate " + n + " from " + s + " to " + d); solve(n - 1, h, d, s); } }
Solve the following puzzle for Tower of Hanoi · If puzzle can be accomplished in 3 moves with two discs. Use this to work out how many moves would be needed with three discs? · If puzzle can be completed in 15 moves with four discs. Use this to work out how many moves would be needed with five discs? · In general, describe a way of working out how many moves are needed when one extra disc is added? ye kese hoga
where did you learn this from because never seen such an explanation like this bro plz tell this bro !! you are amazing liked and subscribed and make a video on books and online material for the best understanding of ds and algo as you used !!!!!!
haha I didnt learn this from anywhere, as the time passed I started to make my own methods and started to see patterns that were never mentioned anywhere before. You will too, just keep practising.
I have a question , this was a little complex solution that had too many variables to track for dry running this code on paper but that didn't matter because of recursion and we solved it easily if we come across a rec code of similar type and had understand it without compiling it can we do it like we solved it (from n to n-1 i mean ) will that be ok
Can't we pop the source stack and push to helper stack(it will be reversed).Then pop the helper stack and push to destination(reversed->reversed: original)?
yar mera time to logo ke funny comments padhne me chala jata h 🤣🤣🤣🤣, bhai ka to logic works like magic , ek bar me hit kar jata h mind me , bas yahi soch reha hu bramha ji kis comapany me honge aur unka package kya hoga abhi 🤣
At 10:19 For smaller input why can't we pop the top of the stack and then remaining n-1 ele par solve func lagaye and the hypothesis can be moving all n-1 from source to destination and then in the induction step we push the poped element at pole 3. Can someone clear what's wrong with this approach?
it cannot be done bcoz when u pop it means u are storing it in any of the one pillar(either helper and destination) and then it cannot be solved for remaining disc by only using one pillar bcoz in the pillar storing the top disc u can't put any other disc as it it is of the least size.
one classic misconception i faced was that while taking the help of helper, even then i have to stay mindful of the condition that its always smaller above the widder one. thus i was overthinking on it. xD
Java Code with Count: public long toh(int N, int s, int d, int h) { if(N == 1) { System.out.println("move disk " + N + " from rod "+ s +" to rod " + d); return 1; } long count = toh(N - 1, s, h, d); System.out.println("move disk " + N + " from rod "+ s +" to rod " + d); count = count + toh(N - 1, h, d, s) + 1; return count; }
bhramaji bole placement aa raha hai coding karo... bhramaji jaisa bole vaisa hai karne ka :) great content... ab kabhi nahi bhuluga iska solution hahahah
11/19 done🙌 working code (to those who r facing difficulty in code) long long toh(int N, int from, int to, int aux) { // Your code here long long count = 1 ; if(N==1){ cout