Is Quicksort a potential security risk?

后端 未结 6 1036
粉色の甜心
粉色の甜心 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:16

    I think this is very much a question of where you're actually using the quick sort. Using O(n^2) algorithms is perfectly fine when your working with arrays of 5 items, for instance. On the other hand, when there's a chance the data can be significantly large, fearing a DoS is not the first problem you'll face - the first problem will be getting bad performance way before you're facing a real problem. Given the large number of other algorithms available, just have it replaced if it's in a critical location.

提交回复
热议问题