Skip to content

Bug Report for quickSort #4424

@Sooraj-jain

Description

@Sooraj-jain

Bug Report for https://neetcode.io/problems/quickSort

Please describe the bug below and include any steps to reproduce the bug or screenshots if possible.

In the tutorial video on QuickSort, it's explained that all elements less than or equal to the pivot should be placed in the left subarray, while elements greater than the pivot go to the right subarray.

However, in the provided Python solution, the condition currently checks only for elements strictly less than the pivot:

Instead of :
if arr[i].key < pivot.key:

should be :
if arr[i].key <= pivot.key:

Note: While both conditions lead to the same final sorted output, using <= instead of < better aligns with the tutorial’s logic. This helps avoid confusion for beginners, especially when tracing the recursive stack and understanding element placement at each step.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions