Skip to content
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

Open
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

Sooraj-s-98
Copy link

No description provided.

@berquist berquist added Chapter This provides a new chapter. (md files are edited) Implementation This provides an implementation for an algorithm. (Code and maybe md files are edited.) labels Oct 16, 2020
@berquist berquist added hacktoberfest-accepted Hacktoberfest The label for all Hacktoberfest related things! labels Oct 27, 2020
@leios
Copy link
Member

leios commented Nov 4, 2020

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).
Copy link
Member

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)
Copy link
Member

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)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

unintended whitespace change?

Comment on lines -26 to +29
* [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)
Copy link
Member

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)
Copy link
Member

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?

@ntindle
Copy link
Member

ntindle commented Aug 28, 2021

[lang: javascript]

@github-actions github-actions bot added the lang: javascript Javascript programming language label Aug 28, 2021
@Amaras Amaras changed the title Quicksort javaScript added Quicksort chapter javaScript added Aug 28, 2021
}

function partition(arr, left, right) {
let middle = Math.floor((right + left) / 2),
Copy link
Contributor

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)

Copy link

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).

@leios
Copy link
Member

leios commented Nov 7, 2021

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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Chapter This provides a new chapter. (md files are edited) Hacktoberfest The label for all Hacktoberfest related things! hacktoberfest-accepted Implementation This provides an implementation for an algorithm. (Code and maybe md files are edited.) lang: javascript Javascript programming language
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants