General statistics
List of Youtube channels
Youtube commenter search
Distinguished comments
About
Anony Mousse
Computerphile
comments
Comments by "Anony Mousse" (@anon_y_mousse) on "Quicksort Algorithm in Five Lines of Code! - Computerphile" video.
@shiinondogewalker2809 The best way is generally to just pick a random element. It can help mitigate a quadratic complexity attack from a carefully crafted array.
6
@shiinondogewalker2809 As long as it's not a predictable element.
2
@shiinondogewalker2809 Yes, but it will also require calling an RNG three times. The fewer calls the better, and an RNG can be quite expensive. Granted, you probably won't notice a performance hit unless you're doing something very wrong in your code, but more complexity does also increase debugging time.
2
@ In practice, unless you know the data type you're dealing with, the pivot would have to be in the array. Consider an array of strings, you can't know what string would fall in the middle without scanning the entire array, especially when you consider that the comparator might be operating on the length first.
2
@AndreiGeorgescu-j9p Talk about arguing in bad faith.
1