Quick sort in 4 minutes

preview_player
Показать описание
Step by step instructions showing how to run quick sort.

Sources:

Рекомендации по теме
Комментарии
Автор

This is great video! but, I feel the algo provided in the end is not the same as the way he was explaining.. I went ahead and wrote my code for it same way he explained:
```
class Solution:
def sortArray(self, nums: List[int]) -> List[int]:

def quicksort(nums, lo, hi):
if lo < hi:
partition_resting_point = partition(nums, lo, hi)
quicksort(nums, lo, partition_resting_point - 1)
quicksort(nums, partition_resting_point + 1, hi)

def partition(nums, lo, hi):
pivotIdx = random.randint(lo, hi)
nums[pivotIdx], nums[hi] = nums[hi], nums[pivotIdx]
pivot = nums[hi]

l_idx = lo
r_idx = hi-1
while l_idx <= r_idx:
if nums[l_idx] <= pivot:
l_idx+=1
elif nums[r_idx] >= pivot:
r_idx-=1
else:
nums[l_idx], nums[r_idx] = nums[r_idx], nums[l_idx]
l_idx+=1
r_idx-=1

nums[l_idx], nums[hi] = nums[hi], nums[l_idx]
return l_idx

quicksort(nums, 0, len(nums)-1)
return nums
```

WhisperingWalnuts
Автор

With every new quick sort video, I watch, I get more recursively confused.

EchoVidsu
Автор

Guy: "I think you understand the concept"

Me: No I don't

jonahrivera
Автор

I feel so dumb when i don't understand this, but then i just scroll the comment section and realise that im not alone lol

SAMURAIch
Автор

*screams in Ross voice* PIVOT! PIVOT! PIVOT!

Charoula
Автор

To ones without enough background knowledge, this video omits details of execution of each step. But to ones with, this is concise and covers sufficient key points of quick sort. Thanks a lot for your video sharing.

yufangjuan
Автор

The psudocode is not intuitively reflecting the walkthrough

LL-rnrn
Автор

How to get Confused in 4 minutes








then again, this was the best video about it so far

theducksneezes
Автор

This is great. The simple explanation and the especially simple pseudocode towards the end makes it easy to understand the core concept of the algorithm.

fr
Автор

you should put the code next to all of the visual aids and highlight each line as its being done in the visual. thanks for the help with sorting!

LGNNorotic
Автор

i put this at 1.5x and now i learnt quick sort 2.6667 minutes

sachinpathy
Автор

when i search for something on youtube and see one of your videos in the results i genuenly get excited

mehdibadaoui
Автор

These are some clean tutorials. Thank you for making this!

dh
Автор

I think I'm here for the fourth time now.

Kleyguy
Автор

That is the exact! same Quick Sort Algorithm we have been thought. Really good! Thanks

okaydayy
Автор

Your short videos helped me a looot. Thank you so much!

seltonmc
Автор

I watched several videos, including my school books, and I had no idea what they were saying with left to right and could not get the answers in the correct order because of that. I was able to understand after watching your video and it allowed me to get past my assignment. Thank you.

brianmartinez
Автор

I study computer science, and once, I had an exam with a few sort algorithms in it. I didn't really study but about twenty minutes before the exam I watched your 2-4 minute videos on these sort algorithms and I passed the exam. Thank you for helping me.

wendyd.
Автор

Psuedo code does not match demonstrated algorithm.

Crzynoob
Автор

Yess I finally understood it, having a clear mind the morning before the exam helped

MewPurPur