-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Description
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.