Is stdlib's qsort recursive?

前端 未结 9 1912
执念已碎
执念已碎 2020-12-30 09:19

I\'ve read that qsort is just a generic sort, with no promises about implementation. I don\'t know about how libraries vary from platform to plaform, but assumi

9条回答
  •  有刺的猬
    2020-12-30 10:22

    You know, the recursive part is logn deep. In 64 levels of recursion (which is ~64*4=~256 bytes of stack total) you can sort an array of size ~2^64, ie an array as large as you can address on a 64 bit cpu, which is 147573952589676412928 bytes for 64 bit integers. You can't even hold it in memory!

    Worry about stuff that matters imo.

提交回复
热议问题