re: What time and space complexity of JavaScript Built-In Sort method? VIEW POST


That Quora reply is correct: it depends on the implementation.

But the most common JavaScript engine (V8), which is used in Chromium browsers as well as Node.js, uses an algorithm known as Timsort, which has a worst-case time performance of O(n log n) and worst-case space complexity of O(n). You can find a great but technical write-up here.


Thank you very much!

Code of Conduct Report abuse