Given a binary search tree, write a function kthSmallest
to find the kth smallest element in it.
Note:
You may assume k is always valid, 1 ≤ k ≤ BST’s total elements.
1 | public class KthSmallestElementInABST { |
Given a binary search tree, write a function kthSmallest
to find the kth smallest element in it.
You may assume k is always valid, 1 ≤ k ≤ BST’s total elements.
1 | public class KthSmallestElementInABST { |