Quickselect time complexity explained
n log(n) implies that the algorithm looks at all N items log(n) times. But that’s not what’s happening with Quickselect. Let’s say you’re using Quickselect to pick the top 8 items in a list of 128. And by some miracle of random selection, the pivots you pick are always at the halfway point. On the … Read more