|
|
|
|
|
by mrami
2521 days ago
|
|
> If swaps are the only thing you are counting, selection sort is O(n). And if you ignore the bottom half of the centaur, it's just a dude playing a flute. :) "In computer science, the time complexity is the computational complexity that describes the amount of time it takes to run an algorithm." [1] We shouldn't be confusing people that actually want to learn about this stuff. [1] https://en.wikipedia.org/wiki/Time_complexity |
|
That is an excellent phrase.
> We shouldn't be confusing people that actually want to learn about this stuff.
I definitely agree that Selection sort should definitely not be described as O(n) to beginners. I was just pointing out a subtly. In the strange case where memory writes are much more expensive than reads or comparisons, it is correct to say the Selection sort takes O(n) time.