Skip to content

Switch quicksort pivot selection strategy to random#156

Merged
raklaptudirm merged 3 commits into
TheAlgorithms:masterfrom
anshvert:random-pivot-quick-sort
Oct 2, 2023
Merged

Switch quicksort pivot selection strategy to random#156
raklaptudirm merged 3 commits into
TheAlgorithms:masterfrom
anshvert:random-pivot-quick-sort

Conversation

@anshvert

@anshvert anshvert commented Oct 1, 2023

Copy link
Copy Markdown
Contributor

Added Random Pivot Quick Sort Algorithm

@appgurueu

Copy link
Copy Markdown
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

anshvert commented Oct 1, 2023

Copy link
Copy Markdown
Contributor Author

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

Comment thread sorts/quick_sort.ts Outdated
@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