What is the time complexity for this algorithm?

91 Views Asked by At

I want to sort first $\sqrt n$ minimum of an array of n elements. What is the time complexity? My approach is : First I have to find the $\sqrt n$ 'th minimum element (name it $x$) which has the time complexity of : $$O(n)$$ Second I have to make $x$ as pivot to place lower elements before $x$ using Partition algorithm which have time complexity of: $$O(n)$$ And then I have to sort these $\sqrt n$ elements using a sort algorithm that has minimum time complexity of: $$O(\sqrt n \times log(n))$$ So the total time complexity should be: $$O(n)$$ but the textbook has the answer of: $$O(\sqrt n \times log(n))$$ I do not know why ? does it mean that: $$n \in O(\sqrt n \times log(n))$$ Or I have mistake in my solution? Best Regards