ALGORITHMS you should know about 👩‍💻 #programmer #computerprogrammer #technology #coder #software

preview_player
Показать описание

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

Bogo sort has the potential of sorting a 20000 terabytes of data in one second

giuliodeangelis
Автор

Fun fact: Bogo sort is the fastest and slowest sort algorithm

HoloDoctor
Автор

Selection sort has one advantage; it uses O(N) data movements, so it's good when moving the data is really expensive. Mergesort, quicksort, and heapsort all use O(N lg N) data movements. My favorite example is sorting palettes in a warehouse using a forklift; selection sort will win every time.

rdwells
Автор

What about Stalinsort?

It just removes any element that isn't in the correct position.

Very effective. 😂

JustPyroYT
Автор

Educational and also fun to watch. We need more of this.

ildaphonse
Автор

I wish i discovered this algorithm sooner. It is ABSOLUTELY the best approach.
Start with an array, if it isn't in order simply switch to finance or retail, really anything other than programming.

UKnowIfUKnow
Автор

Quicksort is an important one to know, because it minimizes memory complexity as well

Nina-cdeh
Автор

A think to remeber: when the list is shorted or partialy sorted(at few elements out of order), bubble sort has the best running time O(n) and Quicksort the worst O(n^2), so pick your alogorithm based on the expected input distribution.

pipesmple
Автор

Count sort is only useful for niche situations, but can be super fast. You make an auxiliary array and begin going through the unsorted array. Each time you encounter a number, you increment that index of the auxiliary array. At the end, your auxiliary array will be the number of instances of each index. There are no comparisons and you just have to loop through 2 arrays. The reason it is niche is because it only really works for arrays with a low range. If your array is 50, 000 elements, but all of the elements are 1-10, it would be incredibly quick, however, if your array is 10 elements with values between 1-50, 000 you waste a lot of space making the auxiliary array and a lot of time looking at indexes with 0s. In the real world, it could be used for sorting a list of ages, temperatures, or number of goals scored by a soccer team.

champion
Автор

If you have a list that seems to be mostly sorted, bubble sort can actually work pretty good

colinmaharaj
Автор

The interesting thing about quick sort is that it will use bubble sort once the elements once everything has been split down to where the number of elements needed to be sorted is sufficiently small enough for insertion sort to handle. However, these sorts are not efficient for large data sets or where swapping elements is quite expensive. There are more efficient data structures that don't require these sorting algorithms.

alexaneals
Автор

Tim sort, like merge sort but faster. It takes into consideration elements that are already sorted.

Time Complexity:
Tim Sort - Best Case O(n)
Merge Sort - Best Case O(nlogn)

For memory, merge sort is better but it’s rare that you’d need merge sort over tim sort.
Space Complexity
Tim Sort: O(n)
Merge Sort: O(1)

jeffenriquez
Автор

merge sort is definitely the best!
quick sort should be more memory efficient since it’s an in place sorting algorithm, but it typically uses much more stack memory

Algebraiic
Автор

I actually like your visualization over others I’ve seen online or in the classroom

blakemcdermott
Автор

That's why programming is so hard for me, the last sorting sounds like the least efficient but actually is the best

IstyManame
Автор

The main problem with merge sort is that it is memory intensive as you need to keep a tree of some sorts to deal with all the halves

nekomi_ch
Автор

The visuals do a lot of work to make this make sense 👏

thomsurcorredor
Автор

A minor benefit of bubble sort is that it's easiest and quickest to code.

Pseudocode:
BubbleSort(array) {
for i -> 0 to arrayLength
for j -> 0 to (arrayLength - i - 1)
if arr[j] > arr[j + 1]
swap(arr[j], arr[j + 1])
}

That's it. Of course, that doesn't excuse that it's slower than a snail in mud, but at least it's friendly to beginners.

Diriector_Doc
Автор

Talking about how good sorting algorithms are based only on how they would perform on big datasets is very reductive, there are applications where you would rather lose time and not use additional memory, which you will do using merge sort, and when we are talking about sorting a bunch of small arrays the differences in time are insignificant. Point is, all algorithms are good for their preferred use cases.

peteeraste
Автор

As someone who currently studies DSA, this video helps me a lot.

ferrouswroughtnaut
visit shbcf.ru