Time complexity to compute the sum of k smallest element in the binary search tree??
can we do it like this-
Start doing the inorder traversal of the binary search tree, it will give the elements in increasing order. Start the counter k=0. As we get the elements we increment the counter and then stop the traversal when count reaches k and sum the elements which we have got. Its time complexity will be O(h+k).
Am i right??
plzz plzz explain someone