Загрузка страницы

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
Показать
Комментарии отсутствуют
Введите заголовок:

Введите адрес ссылки:

Введите адрес видео с YouTube:

Зарегистрируйтесь или войдите с
Информация о видео
20 мая 2020 г. 22:04:01
00:13:07
Яндекс.Метрика