From d35e73e73c5ecd51e11928f33d1682d46712117a Mon Sep 17 00:00:00 2001 From: Kevin Gonzalez Date: Tue, 11 Jun 2019 16:52:03 +0200 Subject: [PATCH 1/5] Added Quicksort description in ReadMe --- README.md | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 1b3a383..8efbf83 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,7 @@ # javascript-references -Material to reference when working with JavaScript + +Material to reference when working with JavaScript + +### Quicksort in JavaScript + +An efficient sorting algorithm, serving as a systematic method for placing the elements of a random access file or an array in order. See https://en.wikipedia.org/wiki/Quicksort From 8979406fce32b61bb686b22ee7b511998bffd42e Mon Sep 17 00:00:00 2001 From: Kevin Gonzalez Date: Tue, 11 Jun 2019 17:01:11 +0200 Subject: [PATCH 2/5] Move Quicksort description to quicksort dir --- README.md | 4 ---- quicksort/README.md | 3 +++ 2 files changed, 3 insertions(+), 4 deletions(-) create mode 100644 quicksort/README.md diff --git a/README.md b/README.md index 8efbf83..bcc622f 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,3 @@ # javascript-references Material to reference when working with JavaScript - -### Quicksort in JavaScript - -An efficient sorting algorithm, serving as a systematic method for placing the elements of a random access file or an array in order. See https://en.wikipedia.org/wiki/Quicksort diff --git a/quicksort/README.md b/quicksort/README.md new file mode 100644 index 0000000..d7f1081 --- /dev/null +++ b/quicksort/README.md @@ -0,0 +1,3 @@ +### Quicksort in JavaScript + +An efficient sorting algorithm, serving as a systematic method for placing the elements of a random access file or an array in order. See https://en.wikipedia.org/wiki/Quicksort From 4ede5796253ab718692996cca29de847ae660965 Mon Sep 17 00:00:00 2001 From: Kevin Gonzalez Date: Tue, 11 Jun 2019 17:52:28 +0200 Subject: [PATCH 3/5] Added documentation with references for quicksort func declaration and return --- quicksort/index.js | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 quicksort/index.js diff --git a/quicksort/index.js b/quicksort/index.js new file mode 100644 index 0000000..bc4c04c --- /dev/null +++ b/quicksort/index.js @@ -0,0 +1,22 @@ +/** + * This is an implementation of the Quicksort algorithm written in JavaScript. + * See https://en.wikipedia.org/wiki/Quicksort#Algorithm + */ + +/** + * The following code contains syntax that, if written incorrectly, would be caught by strict mode. + * See https://github.com/floatsoft/javascript-references/blob/hello-world/varDeclaration.js#L1-L7 + */ +"use strict"; + +/** + * We declare a function named quicksort with a single parameter; arr. + * See https://github.com/floatsoft/javascript-references/blob/bubble-sort/bubble-sort/index.js#L13-L19 + */ +function quicksort(arr) { + /** + * We return our sorted array, arr. + * See https://github.com/floatsoft/javascript-references/blob/bubble-sort/bubble-sort/index.js#L171-L176 + */ + return arr; +} From 38aeae69b9cad841735fa73750d1f9df2ccddacc Mon Sep 17 00:00:00 2001 From: Kevin Gonzalez Date: Tue, 11 Jun 2019 17:53:20 +0200 Subject: [PATCH 4/5] Added documentation with references for array declaration --- quicksort/index.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/quicksort/index.js b/quicksort/index.js index bc4c04c..e9b6f8b 100644 --- a/quicksort/index.js +++ b/quicksort/index.js @@ -20,3 +20,10 @@ function quicksort(arr) { */ return arr; } + +/** + * We declare an array of unsorted numbers using the array literal method, + * we name our new variable unsortedNumbersList. + * See https://github.com/floatsoft/javascript-references/blob/bubble-sort/bubble-sort/index.js#L179-L193 + */ +var unsortedNumbersList = [8, 5, 6, 9, 3, 1, 4, 2, 7, 10]; From 168e64bd235429d64d8e27932f548de8397665b2 Mon Sep 17 00:00:00 2001 From: Kevin Gonzalez Date: Tue, 11 Jun 2019 17:53:59 +0200 Subject: [PATCH 5/5] Added documentation with references for quicksort func call with single param --- quicksort/index.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/quicksort/index.js b/quicksort/index.js index e9b6f8b..3924d6b 100644 --- a/quicksort/index.js +++ b/quicksort/index.js @@ -27,3 +27,9 @@ function quicksort(arr) { * See https://github.com/floatsoft/javascript-references/blob/bubble-sort/bubble-sort/index.js#L179-L193 */ var unsortedNumbersList = [8, 5, 6, 9, 3, 1, 4, 2, 7, 10]; + +/** + * We call our quicksort function, passing our unsortedNumbersList as a single argument. + * See https://github.com/floatsoft/javascript-references/blob/bubble-sort/bubble-sort/index.js#L195-L201 + */ +quicksort(unsortedNumbersList);