TheAlgorithms/JavaScript

[FEATURE]: Improve Quicksort Algorithm with Better Space Complexity

DevAnuragT opened this issue · 4 comments

Motivation

This feature can decrease space complexity of quicksort algorithm and make it efficient.

Examples

This feature will replace use of extra arrays in quicksort function with simple swap functions.

Possible workarounds

No response

Additional information

No response

I can do that please assign me the work

is the issue still open?

hi there, as a data structures and algorithms enthusiast with great interest in javascript let me work on this issue. my leeetcode profile : https://leetcode.com/u/mzip19/

This issue doesn't really make sense: We have two variants of quicksort, one which is in-place and another one which isn't. If anything one of them should be removed / merged with the other, or they should be differentiated based on this. I personally think the "pure functional" variant is nice because it makes the core idea if the algorithm a bit easier to see.

(It should perhaps also be noted that the worst case space complexity for a naive quicksort is still linear, see https://appgurueu.github.io/2023/07/15/on-quicksort.html. That could indeed be improved by being clever about the order of the recursive calls and tail recursion.)