Kth Smallest Element in a BST - LeetCode 230 - Python (Recursive and Iterative!) #leetcode

preview_player
Показать описание
Explaining how to solve Kth Smallest Element in a BST in Python both recursively and iteratively!

@1:19 - Example + Explanation
@3:23 - Recursive Code
@5:48 - Recursive Code Walkthrough with Example
@10:11 - Iterative Code
@12:08 - Iterative Code Walkthrough with Example

Music: Bensound

Lemme know if you have any comments or questions!:)))

Socials:

Playlists:
Рекомендации по теме
Комментарии
Автор

your tree videos are very good, because you are the only one explaining all the recursive steps and the call stacks. where as remaining videos aren't explaining in such detail

creatorsstudio
Автор

Vibrant expressions and Super explanations !

deepakjyoti
Автор

Alternative approach:
Use a max-heap (Python natively provides min heap so reverse it and make it into a max heap) and then add elements to the heap until length is k.
Once the tree traversal is complete return the negative of the first element of the heap

sumanthmurthy
welcome to shbcf.ru