Is Quicksort a potential security risk?

后端 未结 6 1038
粉色の甜心
粉色の甜心 2021-02-02 13:20

I just wondered whether (with some serious paranoia and under certain circumstances) the use of the QuickSort algorithm can be seen as a security risk in an application

6条回答
  •  孤独总比滥情好
    2021-02-02 14:08

    Many implementations of quicksort are done using a randomized version of the algorithm. This means a DoS attack with specially-crafted input is not possible.

    Also, even without this, most data sets are simple too small to have O(nlog) vs O(n^2) matter. The size of the set to sort would have to be quite large to have an impact. Even with a few million elements, the time difference would likely not be very large.

    Overall, any given web-application using quicksort is much more likely to have other security flaws.

提交回复
热议问题