Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: trekhleb/javascript-algorithms
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: master
Choose a base ref
...
head repository: henrycjchen/javascript-algorithms
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: master
Choose a head ref
  • 3 commits
  • 1 file changed
  • 1 contributor

Commits on Feb 8, 2019

  1. switch shift to pop

    according to my test, pop is faster than shift, especially when the array is very long.
    henrycjchen authored Feb 8, 2019
    Copy the full SHA
    769c213 View commit details

Commits on May 4, 2019

  1. Copy the full SHA
    8f3da94 View commit details

Commits on Nov 30, 2019

  1. Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    c92f983 View commit details
Showing with 2 additions and 2 deletions.
  1. +2 −2 src/algorithms/sorting/quick-sort/QuickSort.js
4 changes: 2 additions & 2 deletions src/algorithms/sorting/quick-sort/QuickSort.js
Original file line number Diff line number Diff line change
@@ -19,12 +19,12 @@ export default class QuickSort extends Sort {
const rightArray = [];

// Take the first element of array as a pivot.
const pivotElement = array.shift();
const pivotElement = array.pop();
const centerArray = [pivotElement];

// Split all array elements between left, center and right arrays.
while (array.length) {
const currentElement = array.shift();
const currentElement = array.pop();

// Call visiting callback.
this.callbacks.visitingCallback(currentElement);