Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Jan 1, 2026

Step 6 of the quicksort algorithm description was ambiguous—stating "if the left pointer is less than or equal to the right pointer" could be misread as comparing values instead of array indices. In the walkthrough example, the left pointer holds value 6 and the right pointer holds value 3, yet they swap (correctly, because position 2 < position 4).

Changes

  • Step 6: Added "position" qualifier to clarify comparison is between indices, not values

    • Before: "If the left pointer is less than or equal to the right pointer..."
    • After: "If the left pointer position is less than or equal to the right pointer position..."
  • Example text: Fixed two grammatical errors ("in the right pointer" → "and the right pointer")

Screenshot

Corrected step 6 showing "pointer position" clarification

The change resolves the apparent contradiction where position 2 < position 4 triggers a swap, even though value 6 > value 3.

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • telemetry.astro.build
    • Triggering command: /usr/local/bin/node node /home/REDACTED/work/humanwhocodes.com/humanwhocodes.com/node_modules/.bin/astro build (dns block)
    • Triggering command: /usr/local/bin/node node /home/REDACTED/work/humanwhocodes.com/humanwhocodes.com/node_modules/.bin/astro dev (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Original prompt

I noticed that your pseudocode does not match your example and wanted to verify this with you.

On this page:

https://humanwhocodes.com/blog/2012/11/27/computer-science-in-javascript-quicksort/

step 6

If the left pointer is less than or equal to the right pointer, then swap the values at these locations in the array.

However, in the example

the left pointer is 6 and the right pointer is 3. And yet they are swapped.

Is this a typo or am I reading this wrong?


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Copilot AI self-assigned this Jan 1, 2026
@netlify
Copy link

netlify bot commented Jan 1, 2026

Deploy Preview for humanwhocodes ready!

Name Link
🔨 Latest commit e614b6c
🔍 Latest deploy log https://app.netlify.com/projects/humanwhocodes/deploys/6956d63675adf300085f4dde
😎 Deploy Preview https://deploy-preview-10--humanwhocodes.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

Copilot AI changed the title [WIP] Clarify quicksort pseudocode example Clarify quicksort algorithm step 6: pointer positions vs values Jan 1, 2026
Copilot AI requested a review from nzakas January 1, 2026 20:18
@nzakas nzakas marked this pull request as ready for review January 2, 2026 21:13
@nzakas nzakas merged commit 3e3bdc2 into main Jan 2, 2026
4 checks passed
@nzakas nzakas deleted the copilot/verify-quicksort-example branch January 2, 2026 21:13
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.

2 participants