Every time I open a question and search on youtube for an explanation, the first recommendation is always of this channel Sir your videos are great even in 2021, keep inspiring us with amazing explanations as you always do I am just a random coder, Sir doesn't know me neither do I I just watch his videos because of the way he teaches, making you fall in love with coding Thank you, sir, for your time and hard work
No RUclipsr has teach sooo nicely and so easily the way this guy has teach. This guy made recursion so easy you are amazing ❤️ you deserve 100million likes🙌
Mate I am totally speechless. This is so amazing. Thanks for making the concepts and algorithms looks to simple and clean. Wish you all the best. Keep posting videos :)
Great explanation Sir, but please correct me if I am wrong, if feel second argument head should be the double pointer to hold the address of the pointer of caller of this method, so that caller method head pointer will have address of first node of doubly linkedlist, else in current case we are passing a copy of that pointer which is NULL and which has new address, so caller head is anyway not going to be updated with this. NOTE : this function is not returning anything, else we could have update caller's function head with return value.
thats why it is made static , so that it will not become NULL every time you call the function . Static variables are those variables which have only 1 copy during the entire program . every objects of a class use or access that same static variable . you can also declare Node* prev = NULL outside the function but inside the class , it will work too.
You are awesome Man !!! Great Job. Really Liked your Videos. I wrote this code once by myself, but Now I will remember for ever after seeing your video.
Actually this is a very simple problem: 1. A linked list is a perfectly unbalanced BST. 2. You get a perfectly unbalance binary search tree if you add sorted elements to a it. 3. So you have to read the BST from highest to lowest or lowest to highest value, while creating a linked list.
Very clear and nice explanation. Thank you! What would be the change to convert it to Circular Doubly Linked List (Instead of just to doubly Linked list)? How can we capture the first and last node of DLL and link them to each other using the same recursive function?
Given globally declared CDLL head/tail pointers: cdll_head, cdll_tail; making a couple of changes in step 2 of the algorithm can capture head and tail nodes. _Bool flag = 0; //local declaration if(prev == NULL){ head = p; if(flag == 0){ cdll_head = p; flag = 1; } } //..... (rest of step2 goes hear cdll_tail = p; //Add this at the end of step 2 Once the convert() is done, we can then link the two nodes on the calling function: cdll_head->left = cdll_tail; cdll_tail->right = cdll_head;
This is a great video. I have a Question. The initial structure of the Binary Tree will be lost if we follow this algo. Is there any way to get back the initial structure of Binary Tree?
lol.. why would u want that , doing inplace is a better method ,,,however if u want to preserve it just do inorder traversal and store the node values in an array and then make a doubly link list for those array values.
is there a way to give a name for the DLL first node's pointer which is null and also the DLL last node's pointer which is also null...because I want to make it circular DLL
Looks like he made a mistake there. It should have been passed as node** head and we should have passed &head from the calling function. If there had been no head in the convert function, printing or accessing the doubly linked list outside the convert function would have been difficult
Every time I open a question and search on youtube for an explanation, the first recommendation is always of this channel
Sir your videos are great even in 2021, keep inspiring us with amazing explanations as you always do
I am just a random coder, Sir doesn't know me neither do I
I just watch his videos because of the way he teaches, making you fall in love with coding
Thank you, sir, for your time and hard work
Those white board are so much need and so much forgotten in a certain university. Explanation was spot on. Many thanks
Your teaching remembers me the famous quote "slow and steady win". This problem is asked in one of my faang interview
No RUclipsr has teach sooo nicely and so easily the way this guy has teach. This guy made recursion so easy you are amazing ❤️ you deserve 100million likes🙌
this is probably the best explanation u can find on YT
Mate I am totally speechless. This is so amazing. Thanks for making the concepts and algorithms looks to simple and clean. Wish you all the best. Keep posting videos :)
Sir great video:) the patience with which you teach the algorithm and code is unforgettable.
Wow !! What an explanations .Really amazing dry run Sir.
i love this guy's innocent face
Your explanations are great , plz make more series on other topics as well like recursion , backtracking
Thanks a lot Anamika
Sure
@@vivekanandkhyade sir u don't respond to boys... that's totally unfair..
Really nice explanations sir .You are my one stop solution for tree algorithms😁.
very well Explained Sir!!Thanks for the intution!!
Great explanation Sir, but please correct me if I am wrong, if feel second argument head should be the double pointer to hold the address of the pointer of caller of this method, so that caller method head pointer will have address of first node of doubly linkedlist, else in current case we are passing a copy of that pointer which is NULL and which has new address, so caller head is anyway not going to be updated with this.
NOTE : this function is not returning anything, else we could have update caller's function head with return value.
Agreed.
yes correct
Agree
Yes it is correct but i would also replace static variable with extra function parameter and pass it by pointer
Its the best explanation ever....!
Awesome way of teaching, thanks you are helping a lot in my placement preparation !!
I am learning tree for first time and the video helped me to cleary understand the recursion concepts in tree... Thanks a lot
Damn!! Hats Off to you sir. Thankyou so much for this wonderful explanation. :)
great job sir!!definitely the best explaination for the topic
Just Rocked with Binary tree !!! Great bro !! You are saving many peoples life
Amazing explanation, thank you so much
this is amazing and detailed . Thank you
Sir, won't the line "static prev=NULL" cause a trouble, as every function call will set prev to NULL ?
i am having the same doubt
thats why it is made static , so that it will not become NULL every time you call the function . Static variables are those variables which have only 1 copy during the entire program . every objects of a class use or access that same static variable . you can also declare Node* prev = NULL outside the function but inside the class , it will work too.
Gajab sir aag lga di awesome :)
great explanation sir!
Very precisely and effectively explained Seriously Hats off to you.Bohat mza aaya lecture dekh kr.Lots of love from Pakistan
You are great please upload more videos
He is a gem❤️
great explanation sir
You are awesome Man !!! Great Job. Really Liked your Videos. I wrote this code once by myself, but Now I will remember for ever after seeing your video.
Amazing explanation..Great job!!!
amazing.. really amazing.. u r tushar roy of Linked list and trees.
Great!!!! Very concise and easy understandable explanation!!!! Thank you
Actually this is a very simple problem:
1. A linked list is a perfectly unbalanced BST.
2. You get a perfectly unbalance binary search tree if you add sorted elements to a it.
3. So you have to read the BST from highest to lowest or lowest to highest value, while creating a linked list.
Thank you for the video :) Can you also discuss time and space complexities of your solutions.
Did you not watch the video? He discusses both the time and space complexities.
thank you so much sir..
Great Explaination Sir
thnk you soooooo much !!!!!! Your explanation is awesomeeeee
Sir u are amazing
This is a really good step by step explanation. Thank you.
Thank you very much man for the detailed explanation.
very nicely explained, sir.
Thank you for video
Sir aise hi speed maintain karke rakhna. Fir bade ache se samajh ata hai. jinko slow lagta hai Fast Forward ka option hai unke liye RUclips me.
Superb Explanation sir!!
Awesome way to explain a difficult topic. You have a great gift and thanks for sharing your wisdom with us.
thank you sir
Most welcome
nice video ...every step is clearly explained
Good explanation, really helpful.
Great explanation. Thank you!
Amazing! Thank YOU sir
Very clear and nice explanation. Thank you!
What would be the change to convert it to Circular Doubly Linked List (Instead of just to doubly Linked list)?
How can we capture the first and last node of DLL and link them to each other using the same recursive function?
Given globally declared CDLL head/tail pointers: cdll_head, cdll_tail; making a couple of changes in step 2 of the algorithm can capture head and tail nodes.
_Bool flag = 0; //local declaration
if(prev == NULL){
head = p;
if(flag == 0){
cdll_head = p;
flag = 1;
}
}
//..... (rest of step2 goes hear
cdll_tail = p; //Add this at the end of step 2
Once the convert() is done, we can then link the two nodes on the calling function:
cdll_head->left = cdll_tail;
cdll_tail->right = cdll_head;
Muy bueno, saludos desde Uruguay.
nice explaination
just watch it to 1.5 playback speed
Thankyou sir! you are awesome!
Thank you
Thanks a lot!
great work sir!!!
Can you please post videos on - in/pre/post order traversals without recursion?
what an explanation !!! bravo
Very well explained.
thanks for sharing these information.
the condition prev=NULL will be wrong if we code because there will be no. of testcase. you need to check head is null or not
Great video!. Can you post any video to convert doubly linked list to Binary tree?
Hi vivekananda, can u make video for same question but in iterative way NOT recursive way
ausum explanation..!!
You are amazing, thank you very much!
Very clear. thank you mate
Can you do binary tree to circular doubly linked list ? If you do that it will be very helpful
Excellent explanation! Thank you
at 16:00 there is main concept which will remove all confusion.
Nice article
You deserve more followers! Great video. By the way was that Marathi accent? :)
Good Explaination!
Amazing✨
helped in understanding the topic in no time. keep on making videos
great!😇
great explanation! is there a python solution for this code anywhere?
This is a great video.
I have a Question.
The initial structure of the Binary Tree will be lost if we follow this algo.
Is there any way to get back the initial structure of Binary Tree?
the problem requests that we change the tree in place, meaning we change the structure. So no there will be no way
lol.. why would u want that , doing inplace is a better method ,,,however if u want to preserve it just do inorder traversal and store the node values in an array and then make a doubly link list for those array values.
very nice
Great explanation!!!
Hi Nice watching yr video , can you please xplain DLL to BST
y only inorder or BFS based traversal needs to be followed for converting a BT to DLL?
can you explain fenwick Tree and segment tree ??
Great Explanation:)
nice
is there a way to give a name for the DLL first node's pointer which is null and also the DLL last node's pointer which is also null...because I want to make it circular DLL
0:06 Thanos
u are awesome.......awesomeawesomeawesomeawesomeawesomeawesomeawesome..
I don't think there was any reason to pass around 'head' parameter in the convert function. (Or may be I am missing something)
Looks like he made a mistake there.
It should have been passed as node** head and we should have passed &head from the calling function.
If there had been no head in the convert function, printing or accessing the doubly linked list outside the convert function would have been difficult
or can we write head->left = prev->right after the Convert function so that it becomes Circular DLL
head->left= prev and prev->right = head, this will make it a Circular DLL
swap the node in forward directions plz make the videos of this
excellently explained :) bravo !!
Can You please , give a tutorial for converting BST to Circular Linke List
Sir its not usefull to take prev as static. Because if we want to apply it on two bst the second one would be linked to the first one
thinks from egypt
Better than the f*****g nptel
Thank you so much !!!!
is space complexity is O(1)?
o(H) - call stack
8:16 ---reason y prev is static
because if it's not the value of prev will vanish when we exit recursion but instead we are using static so a prev can be maintained globally
THANKS SIRR!!!
You are doing awesome job :)