Skip to content

Switch quicksort pivot selection strategy to random #156

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Oct 2, 2023
Merged

Switch quicksort pivot selection strategy to random #156

merged 3 commits into from
Oct 2, 2023

Conversation

anshvert
Copy link
Contributor

@anshvert anshvert commented Oct 1, 2023

Added Random Pivot Quick Sort Algorithm

@appgurueu
Copy link
Contributor

Please don't duplicate the existing quicksort code. Instead, you should parameterize quicksort in terms of a pivot choosing function. Here is how I did that on the Lua repo, for example; essentially you should replace Math.floor((right + left) / 2) with choosePivot(right, left) where choosePivot is a parameter.

@anshvert
Copy link
Contributor Author

anshvert commented Oct 1, 2023

Sure. Added random pivoting to existing Quick Sort Algorithm. @appgurueu

@appgurueu appgurueu changed the title feat: add Random Pivot Quick Sort Switch quicksort pivot selection strategy to random Oct 1, 2023
@raklaptudirm raklaptudirm merged commit 4db3278 into TheAlgorithms:master Oct 2, 2023
appgurueu added a commit that referenced this pull request Oct 3, 2023
raklaptudirm pushed a commit that referenced this pull request Oct 4, 2023
* Revert "Switch quicksort pivot selection strategy to random (#156)"

This reverts commit 4db3278.

* Formatting filenames 7337853

* Update DIRECTORY.md

---------

Co-authored-by: autoprettier <actions@github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants