1 votes 1 votes If in this question, if we were asked to find the nth smallest number, then what would have been the answer? Ajit J asked Jan 2, 2019 Ajit J 278 views answer comment Share Follow See all 4 Comments See all 4 4 Comments reply Shamim Ahmed commented Jan 2, 2019 reply Follow Share O(n) 0 votes 0 votes Ajit J commented Jan 2, 2019 reply Follow Share But how brother? 0 votes 0 votes Shamim Ahmed commented Jan 3, 2019 reply Follow Share Lets start from the root. The number of comparisons to get smallest number among root and its 2 children is 3. So O(1) time. Secondly, to get 7th smallest number we need constant number of comparison. Hence again O(1). Now lets extend this comparison to n levels. In that that case we might have to use a hash table and the complexity would rise up to O(n). Hope it helps.. 0 votes 0 votes Ajit J commented Jan 3, 2019 reply Follow Share What an answer brother. Thanks 0 votes 0 votes Please log in or register to add a comment.
0 votes 0 votes I think (n logn) aimhigh answered Jan 2, 2019 aimhigh comment Share Follow See 1 comment See all 1 1 comment reply Ajit J commented Jan 2, 2019 reply Follow Share How? 0 votes 0 votes Please log in or register to add a comment.