qsort python code bug

Hi Leetcode team,

I noticed an issue with the qsort algo on your articles - it results in incorrect sorting!
Instead of the below incorrect code replace it with the correct code. The second call to qsort doesnt account for the Pivot element.

#incorrect code
def qsort(lst, lo, hi):
   if lo < hi:
        p = partition(lst, lo, hi)
        qsort(lst, lo, p - 1)
        qsort(lst, p + 1, hi)
		

#correct code
def qsort(lst, lo, hi):
   if lo < hi:
        p = partition(lst, lo, hi)
        qsort(lst, lo, p - 1)
        qsort(lst, p, hi)		
Comments (0)
No comments yet.