Is it possible to get a stack overflow while using quicksort in average running time?

前端 未结 2 679
被撕碎了的回忆
被撕碎了的回忆 2021-01-27 10:10

I know that this sounds stupid, but if we assume that we are lucky and get an average time complexity of O(NlogN) every single time for quick sort, then regardless of the size o

2条回答
  •  时光取名叫无心
    2021-01-27 10:28

    You cannot calculate this without having the number of elements you are considering for your input. Stack overflow error in this case would be a function of "number of elements" and "stack size". Out of these you are missing one.

提交回复
热议问题