-
-
Notifications
You must be signed in to change notification settings - Fork 356
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
Quicksort chapter javaScript added #770
base: main
Are you sure you want to change the base?
Conversation
Thanks for the chapter! I'll try to do chapter reviews over the weekend! |
|
||
##### Text | ||
|
||
The text of this chapter was written by [James Schloss](https://github.com/leios) and is licensed under the [Creative Commons Attribution-ShareAlike 4.0 International License](https://creativecommons.org/licenses/by-sa/4.0/legalcode). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this could be an instance where it wasn't by the amazing @leios
|
||
{% method %} | ||
{% sample lang="js" %} | ||
[import:31-38, lang:"javascript"](Code/javascript/quicksort.js) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this seems like a restrictive range, why not the whole file?
@@ -33,7 +35,7 @@ | |||
* [Physics Solvers](contents/physics_solvers/physics_solvers.md) | |||
* [Verlet Integration](contents/verlet_integration/verlet_integration.md) | |||
* [Quantum Systems](contents/quantum_systems/quantum_systems.md) | |||
* [Split-Operator Method](contents/split-operator_method/split-operator_method.md) | |||
* [Split-Operator Method](contents/split-operator_method/split-operator_method.md) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
unintended whitespace change?
* [Jarvis March](contents/jarvis_march/jarvis_march.md) | ||
* [Graham Scan](contents/graham_scan/graham_scan.md) | ||
* [Jarvis March](contents/jarvis_march/jarvis_march.md) | ||
* [Graham Scan](contents/graham_scan/graham_scan.md) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
unintended whitespace change?
@@ -15,6 +15,8 @@ | |||
* [Sorting and Searching](contents/sorting_and_searching/sorting_and_searching.md) | |||
* [Bubble Sort](contents/bubble_sort/bubble_sort.md) | |||
* [Bogo Sort](contents/bogo_sort/bogo_sort.md) | |||
* [Merge Sort](contents/merge_sort/merge_sort.md) | |||
* [Quick Sort](contents/quick_sort/quick_sort.md) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not seeing a merge_sort.md file added? is that intentional?
[lang: javascript] |
} | ||
|
||
function partition(arr, left, right) { | ||
let middle = Math.floor((right + left) / 2), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is good practice to use const
instead of let
for variables where the value doesn't change. (see let len
on line 5 too)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FYI, I'm not sure how important it is, but it's generally good practice to do something like:
...
let middle = Math.floor( left + (right - left)/2 ),
...
As this avoids the possibility of overflow (see here).
I realize it's been a year, but we are now willing to merge community chapters into the algorithm archive, so we can work on this if you are still willing to help! |
No description provided.