Tag: BST

  • Kth Smallest Element in a Binary Search Tree

    Given a binary search tree, find the kth smallest element in it. For example, For the below tree: If k = 3, Then the kth (3rd) smallest element is 3. If k = 2, Then the output is 2. Try out the solution here: https://leetcode.com/problems/kth-smallest-element-in-a-bst/ Solution: Hint : Use inorder traversal. Explanation: Approach 1 –…