So shell sort is basically to compare two numbers from a fixed distance, and put it so that the bigger is on the right of the two numbers' original position, then divide the distance by a half and repeat, until everything's solved.
@mrninjagon2706 жыл бұрын
Close. What you just described is Comb Sort. Shell sort takes a subset of numbers a given distance apart from each other and performs an insertion sort on them, rather than simply swapping two values at a time.
@ahmidahmid93036 жыл бұрын
shell sort is confusing not that simple when a gap is selected all the indexs which fall into the gap will be like separate array ! so it partitioned the array into parts ! when a match if found in that part every elemnt is "inserted" into the correct spot the "swap" process is a mean to insert the pointer will go down that array in loop wise direction until the smallest spot is found then it will return to position where the match is found to push the other bigger element into spot while doing so if smaller element matched the process is re-done not that simple to wrap around
@carmennegron9586 жыл бұрын
Yes ands its the 2nd most effective sort if radix isnt in the sorting equation neither is time sort tim sort or gravity sort
@Franx-bd8om5 жыл бұрын
gap = half length while gap not 0 do { for i = gap to length do { tmp = item at i j = i while j >= gap and item at j - gap > item at j do { item at j = item at j - gap } item at j = tmp } gap = half itself }
@raffimolero644 жыл бұрын
It actually works better if the gap is not exactly half length, the exact sequence isn't known and is bound by theory.
@vitex1982 жыл бұрын
Shell sort is kind of like the equivalent of running a comb over the list over and over again until it's sorted.
@origamiscienceguy665811 ай бұрын
No, that's comb sort.
@vitex19811 ай бұрын
@@origamiscienceguy6658 yeah I learned that comb sort was a thing in the year since I made that comment lol
@blargl12111 жыл бұрын
Dubstep at its core.
@morgansullivan639711 жыл бұрын
These are all really cool but I wish there was a layman-friendly explanation for how each one works. It's fun trying to figure it out on my own but I am completely lost with this one. :(
@nessy30985 жыл бұрын
T Orrent (ik this thread is 4 months old but still) that would make it impossible if the smallest value was on the right or if the biggest value was on the left. When used in a computer this would be a problem.
@zecuse5 жыл бұрын
If you know what Insertion sort is, look up Comb sort. Shell sort is an Insertion based Comb sort (instead of Bubble based).
@smaybius2 жыл бұрын
It's insertion sort, but the item skips a certain number of spaces back, and the gap decreases per pass. Once the gap is all the way small, it's plain insertion sort
@theAmazingJunkman Жыл бұрын
It looks like comb sort, but its actually a hyper optimized, divide-and-conquer version of insertion sort
@want-diversecontent38876 жыл бұрын
Shell sort: Insertion sort on gaps. You might think it's best to do 2^n, but you can do better than that.
@cmyk89642 жыл бұрын
Yeah, 2ˆn-1 seems to do better, and there’s, like, an experimentally-derived polynomial for it.
@FarmYardGaming Жыл бұрын
0:39 The original Bowser Castle theme
@legendgames1286 жыл бұрын
I learned that you compare 2 elements at a distance and sort them, move on to the next element and repeat until I get to the end of the array, make the comparison distance - 1 = new distance and so forth
@zionj1046 жыл бұрын
Actually, you make the comparison distance half, not -1
@Tumbolisu4 жыл бұрын
Actually, you compare 2 elements at a fixed distance (aka gap size). If you had to swap them, compare with the one *back* that same distance away and repeat until no more swapping occurs. (Or you reach the beginning of the array.) Move on to the next element and repeat until you reach the end of the array. Then, chose a smaller gap size and repeat. Chosing a gap size is not trivial. Halfing the gap size each time is actually the worst you can do! An odd mix of seemingly arbitrary numbers has so far been the best choice ever found. (1, 4, 10, 23, 57, 132, 301, 701 and 1750. No further numbers are known.)
@groszak18 жыл бұрын
It's Incerpi-Sedgewick gap sequence, not Sedgewick. Multiple gap sequences may be named Sedgewick
@want-diversecontent38876 жыл бұрын
Gnome shell sort. Like shell sort, but instead of applying insertion sort, you apply gnome sort.
@megamutant45394 жыл бұрын
Want - Diverse Content bubble shell sort
@juanvdvkuriboh4 жыл бұрын
Pinche sonido tétrico que genera.
@user-cq8xj7ck2u5 жыл бұрын
IT'S SORT ALGORITM
@ars70703 жыл бұрын
The final sound tho 😅😅
@Evy_SX3 жыл бұрын
WAYTOODANK HOLY
@Ambipie4 жыл бұрын
Oh i see. Conch shells.
@smaybius2 жыл бұрын
It's named after Donald Shell, the creator of the algorithm