Delete Node in a BST | LeetCode 952 | C++, Java, Python

  Рет қаралды 9,437

Knowledge Center

Knowledge Center

Күн бұрын

LeetCode Solutions: • LeetCode Solutions | L...
August LeetCoding Challenge: • Playlist
Github Link: github.com/Kno...
*** Best Books For Data Structures & Algorithms for Interviews:*********
1. Cracking the Coding Interview: amzn.to/2WeO3eO
2. Cracking the Coding Interview Paperback: amzn.to/3aSSe3Q
3. Coding Interview Questions - Narasimha Karumanchi: amzn.to/3cYqjkV
4. Data Structures and Algorithms Made Easy - N. Karumanchi: amzn.to/2U8FrDt
5. Data Structures & Algorithms made Easy in Java - N. Karumanchi: amzn.to/2U0qZgY
6. Introduction to Algorithms - CLR - Cormen, Leiserson, Rivest: amzn.to/2Wdp8rZ
*****************************************************************************
August LeetCoding Challenge | Problem 31 | Delete Node in a BST | 31 August,
Facebook Coding Interview question,
google coding interview question,
leetcode,
Delete Node in a BST,
Delete Node in a BST c++,
Delete Node in a BST Java,
Delete Node in a BST python,
Delete Node in a BST solution,
450. Delete Node in a BST,
#CodingInterview #LeetCode #AugustCodingChallenge #Google #Amazon #bst #Trees #BinaryTree

Пікірлер: 27
@ChristianESL
@ChristianESL 4 жыл бұрын
Thanks so much. This is a really hard problem. It is always the hard part to delete something in a tree. Your explanation was amazing. I hope you can fullfill your dream and someday work in Google.
@KnowledgeCenter
@KnowledgeCenter 4 жыл бұрын
Welcome. This was probably my first and last interview at Google. Now having a Senior(Staff) Deep Learning Eng. role, and having a much higher compensation than discussed with Google recruiter(for SWE role), it would be my moral obligation to justify the Role and work for a long time and contribute to the success of the firm. And after that I get another promo after let's say 4-5 yrs, I would be even more obliged. Just anticipating.
@ayushthakur2896
@ayushthakur2896 3 жыл бұрын
U are a gem!!!!!!!!!!!
@KnowledgeCenter
@KnowledgeCenter 3 жыл бұрын
Thanks for the compliment.
@saranguru6100
@saranguru6100 3 жыл бұрын
After seeing the way you explained, I have subscribed with love
@KnowledgeCenter
@KnowledgeCenter 3 жыл бұрын
Thanks.
@gauravchandel8188
@gauravchandel8188 3 жыл бұрын
The given BST is incorrect as 9 should be placed right of 8 not in the left. If we take inorder of the given BST, it won’t be in ascending order. Inorder: 4,7,9,8,10,12 Which is incorrect
@KnowledgeCenter
@KnowledgeCenter 3 жыл бұрын
AT 7:12, I correct it, saying "There is a mistake, and swap 8 and 9". Thanks for pointing out.
@shaziakaleem1895
@shaziakaleem1895 4 жыл бұрын
Very well explained! Thank you for making it so easier.
@KnowledgeCenter
@KnowledgeCenter 4 жыл бұрын
Glad it was helpful!
@rahuljain5642
@rahuljain5642 3 жыл бұрын
NOTE : LEFT SUBTREE OF node 8 is 9 , how ?? @Knowledge Center The example you discussed in the whole video even is not a BST. It might be a mistake, I noticed & hence informing. Hope it helps other students to not get a misconception about the properties of BST. Binary Search Tree is a node-based binary tree data structure that has the following properties: The left subtree of a node contains only nodes with keys lesser than the node’s key. The right subtree of a node contains only nodes with keys greater than the node’s key. The left and right subtree each must also be a binary search tree.
@KnowledgeCenter
@KnowledgeCenter 3 жыл бұрын
Right. I also corrected myself at 7:10, in the video
@rohithchandra7675
@rohithchandra7675 3 жыл бұрын
Hi, don't you think the given BST in the example is wrong. 8 should be in place of 7 and 7,4 should be left of 8?
@KnowledgeCenter
@KnowledgeCenter 3 жыл бұрын
AT 7:12, I correct it, saying "There is a mistake, and swap 8 and 9". Thanks for pointing out.
@sharifmansuri607
@sharifmansuri607 4 жыл бұрын
Thank you very much.. Superb explanation
@KnowledgeCenter
@KnowledgeCenter 4 жыл бұрын
Glad you liked it
@srikantsharma6430
@srikantsharma6430 4 жыл бұрын
Well explained!
@himanshushashank8775
@himanshushashank8775 4 жыл бұрын
Thanks for the explanation !!!
@KnowledgeCenter
@KnowledgeCenter 4 жыл бұрын
Glad it was helpful!
@ragavkishoreg
@ragavkishoreg 4 жыл бұрын
If we need to balance the tree after deletion . How can we do it??
@KnowledgeCenter
@KnowledgeCenter 4 жыл бұрын
The node to be deleted might be on a completely unbalanced branch. So, if you follow balancing around that branch using AVL kind of rotation, other branches may still be unbalanced. So, the best way to convert this to a balanced BST would be to: Step 1: Do inorder traversal of this BST. So, we have a sorted list of node values. [O(n)] Step 2: Build a Balanced BST from sorted values. [O(n)] So, overall it will take O(n) time. And once it is balanced, from next deletions on the same tree, just rotations should work.
@ragavkishoreg
@ragavkishoreg 4 жыл бұрын
@@KnowledgeCenter Thanks a lot ..🙏🙏
@janmichaelaustria620
@janmichaelaustria620 4 жыл бұрын
thank you sir!
@himanshupatel4063
@himanshupatel4063 4 жыл бұрын
sir which software you use for writing .
@KnowledgeCenter
@KnowledgeCenter 4 жыл бұрын
Powerpoint.
@himanshupatel4063
@himanshupatel4063 4 жыл бұрын
@@KnowledgeCenter thank you sir and your videos are amazing
@KnowledgeCenter
@KnowledgeCenter 3 жыл бұрын
Thanks.
Delete Node in a BST - Leetcode 450 - Python
12:59
NeetCodeIO
Рет қаралды 40 М.
All Elements in Two Binary Search Trees | LeetCode 1305 | C++, Java, Python
22:33
АЗАРТНИК 4 |СЕЗОН 3 Серия
30:50
Inter Production
Рет қаралды 831 М.
大家都拉出了什么#小丑 #shorts
00:35
好人小丑
Рет қаралды 90 МЛН
Random Point in Non-overlapping Rectangles | LeetCode 497 | C++, Python
26:35
Minimum Cost For Tickets | LeetCode 983 | C++, Java, Python
18:38
Knowledge Center
Рет қаралды 14 М.
Delete Node in a BST | leetcode 450 | Hindi
16:32
Codebix
Рет қаралды 4,7 М.
Top 7 Algorithms for Coding Interviews Explained SIMPLY
21:22
Codebagel
Рет қаралды 379 М.
Delete a node from Binary Search Tree
18:27
mycodeschool
Рет қаралды 1,1 МЛН
Delete Node in a BST | Leet code 450 | Theory explained + Python code
16:04
Image Overlap | LeetCode 835 | C++, Java, Python
21:44
Knowledge Center
Рет қаралды 8 М.
Non-overlapping Intervals | LeetCode 435 | C++, Java, Python
20:35
Knowledge Center
Рет қаралды 7 М.
L15. Check for Balanced Binary Tree | C++ | Java
12:30
take U forward
Рет қаралды 328 М.
АЗАРТНИК 4 |СЕЗОН 3 Серия
30:50
Inter Production
Рет қаралды 831 М.