Kth Smallest Element in a BST | Leetcode #230
This video explains a very important problem which is to find the Kth smallest element in a binary search tree. This is a very common programming interview question for most companies and it can be solved by many techniques. I have shown 3 methods to solve this in increasing order of optimizations. The first method is the simplest which is done just by inorder traversal and storing the elements in an array and returning the (K-1)th index element as answer. The second method uses recursion/stack to solve the problem. The third method is the most optimized approach and it uses a special BST property to find the Kth smallest element in just O(Height) time. I have also explained the CODE at the end of the video. CODE LINK is present below as usual. If you find any difficulty or have any query then do COMMENT below. PLEASE help our channel by SUBSCRIBING and LIKE our video if you found it helpful...CYA :)
LinkedIn: https://www.linkedin.com/in/surya-pratap-kahar-47bb01168
CODE LINK: https://gist.github.com/SuryaPratapK/8c1ad7d1c296adb3dd67153f5b3f0ac8
SIMILAR PROBLEMS:
Kth largest element in an array: https://youtu.be/aXJ-p3Qa4TY
Check if a tree is bst or not: https://youtu.be/TKvbwPIOGCM
Видео Kth Smallest Element in a BST | Leetcode #230 канала TECH DOSE
LinkedIn: https://www.linkedin.com/in/surya-pratap-kahar-47bb01168
CODE LINK: https://gist.github.com/SuryaPratapK/8c1ad7d1c296adb3dd67153f5b3f0ac8
SIMILAR PROBLEMS:
Kth largest element in an array: https://youtu.be/aXJ-p3Qa4TY
Check if a tree is bst or not: https://youtu.be/TKvbwPIOGCM
Видео Kth Smallest Element in a BST | Leetcode #230 канала TECH DOSE
Показать
Комментарии отсутствуют
Информация о видео
Другие видео канала
![FACEBOOK - KTH SMALLEST ELEMENT IN A BST (LeetCode)](https://i.ytimg.com/vi/C6r1fDKAW_o/default.jpg)
![Vertical order traversal of a binary tree | Leetcode #987](https://i.ytimg.com/vi/kqHNP6NTzME/default.jpg)
![How to crack dream job in just 2 months](https://i.ytimg.com/vi/gX8ZapEkpUY/default.jpg)
![Find the k'th Largest or Smallest Element: From Sorting To Heaps To Partitioning](https://i.ytimg.com/vi/hGK_5n81drs/default.jpg)
![Jump game | Leetcode #55 | Valley peak approach](https://i.ytimg.com/vi/muDPTDrpS28/default.jpg)
![Subarray sum equals K | Number of subarrays with sum equals K | Leetcode #560](https://i.ytimg.com/vi/HbbYPQc-Oo4/default.jpg)
![Minimum edit distance | Dynamic programming | Backtracking](https://i.ytimg.com/vi/AuYujVj646Q/default.jpg)
![](https://i.ytimg.com/vi/qKN1b_S97Ak/default.jpg)
![Find min and max element in a binary search tree](https://i.ytimg.com/vi/Ut90klNN264/default.jpg)
![Sum of given range | Segment tree construction and update | Simplest explanation](https://i.ytimg.com/vi/2bSS8rtFym4/default.jpg)
![Kth largest element in an array | Kth smallest element in an array](https://i.ytimg.com/vi/aXJ-p3Qa4TY/default.jpg)
![Morris Inorder Tree Traversal](https://i.ytimg.com/vi/wGXB9OWhPTg/default.jpg)
![Number of islands | Leetcode #200](https://i.ytimg.com/vi/__98uL6wst8/default.jpg)
![Largest BST in Binary Tree](https://i.ytimg.com/vi/4fiDs7CCxkc/default.jpg)
![Find Median from Data Stream](https://i.ytimg.com/vi/1LkOrc-Le-Y/default.jpg)
![Uncrossed Lines | Dynamic programming | Leetcode #1035](https://i.ytimg.com/vi/duCx_62nMOA/default.jpg)
![Kth Smallest Element in a BST](https://i.ytimg.com/vi/5LUXSvjmGCw/default.jpg)
![Construct binary search tree from preorder traversal | Leetcode #1008](https://i.ytimg.com/vi/9sw8RRsBw6s/default.jpg)
![Check if a binary tree is binary search tree or not](https://i.ytimg.com/vi/yEwSGhSsT0U/default.jpg)
![Word Ladder | Leetcode #127](https://i.ytimg.com/vi/ZVJ3asMoZ18/default.jpg)