In the Alternate Approach Section to find the Kth smallest number using minHeap, you have suggested to use an heap size of N to insert all elements. Can’t this be done in a heap size of (N-k+1) just as we did for maxHeap ? We can compare all remaining elements with top of the heap(which is the minimum) and remove the top if the current element is greater. We will finally have (k-1) minimum elements outside the heap. and n-k+1 maximum elements inside the heap. The root/top of the heap will represent the kth smallest element.
Hence time complexity for this approach should be O(k*log(N-k)+(N-k))
and space complexity should be O(N-k)