Sorting Algorithms: Shellsort

Поделиться
HTML-код
  • Опубликовано: 1 фев 2025

Комментарии • 68

  • @pinkrey4277
    @pinkrey4277 5 лет назад +42

    where are the bleep bloops??

  • @gisibah
    @gisibah 8 лет назад +278

    Wrong sort. Shellsort uses more than 2 sorting lines. The sort in the video is Comb sort.

    • @Al93271
      @Al93271 6 лет назад +13

      Yeah, I'm pretty sure Shell sort uses 4 sorting lines.

    • @Fera-gr5mm
      @Fera-gr5mm 6 лет назад +8

      How, why 4 sorting lines? If it compares 2 items...?

    • @raffimolero64
      @raffimolero64 6 лет назад +14

      KooperSpeederYT
      i thought shell sort was just insertion sort with distance

    • @dlwatib
      @dlwatib 5 лет назад +17

      Review Shell sort and Comb sort descriptions in wikipedia. Your idea about Shell sort having 4 sorting lines is wrong. The two have very similar patterns, but Shell sort is a variation of Insertion sort and Comb sort is a variation of Bubble sort.

    • @okboing
      @okboing 4 года назад

      Actually no comb sort is the one to use multiple comparisons

  • @J7Handle
    @J7Handle 6 лет назад +85

    Comb/shell sort appears like a great way to make a randomly ordered list ALMOST sorted but not entirely. Like if you wanted to organize a library and called it good enough when every book was less than 5 places from its correct position, you could use comb/shell sort to sort more quickly than another sort that goes to completion.

    • @ThePoketrix
      @ThePoketrix 6 лет назад +8

      Except comb/shell DOES go all the way. When it's almost sorted, both comb and shell swap over to what I believe to be Bubble Sort for the last few passes.

    • @Fera-gr5mm
      @Fera-gr5mm 6 лет назад +4

      @@ThePoketrix Or insertion sort

    • @AgiHammerthief
      @AgiHammerthief 4 года назад

      (how) would you use this on physical objects? might be a long way to travel between comparisons.

    • @dragonslayerz2220
      @dragonslayerz2220 2 года назад

      @@ThePoketrix Not really, they just are effectively the same at the minimum interval.

    • @BigFatWedge
      @BigFatWedge Год назад

      This isn't Shell Sort. It's just Comb Sort. Shell Sort is Insertion Sort on large intervals. Shell Sort is more sophisticated than this.

  • @danieldelizaur8613
    @danieldelizaur8613 8 лет назад +122

    that is a comb sort, not a shell sort!

    • @sasoribi1341
      @sasoribi1341 5 лет назад +1

      Daniel De Lizaur 昆布は草

    • @veronikadawson8319
      @veronikadawson8319 5 лет назад

      @@sasoribi1341 昆布とシェルはどう違うんですか?

  • @devinandcarrietotaldrama505
    @devinandcarrietotaldrama505 5 лет назад +10

    This is comb sort!

  • @starsiix
    @starsiix 4 года назад +4

    people in the comments: this is a comb sort!!!!!!!!
    me: haha it do the thing and then vwoomp triangle hehe

  • @jesarux8233
    @jesarux8233 6 лет назад +11

    now these points of data make a beautiful line...

  • @oliveguy3114
    @oliveguy3114 7 лет назад +30

    Is the last one simplified to reduce the comparison window by like 100 instead of one unit?

  • @thedoubleap
    @thedoubleap 4 года назад +3

    comb sort is bubble sort
    shell sort is insertion sort

  • @mandolinic
    @mandolinic 5 лет назад +10

    This seems reasonably fast in getting data "almost" sorted, but agonisingly slow in the final stages. What if you were to run a few passes on the data, then switch to quick sort - using the centre element of each partially sorted group as the pivot?

    • @stanrogers5613
      @stanrogers5613 5 лет назад +4

      That makes things hugely bad for quicksort - the closer you get to "already sorted", the worse quicksort does. The better modern library implementations of quicksort will look at the recursion depth and switch to something like Shell or a simple insertion sort when it encounters the "almost sorted" - or worse, "already sorted" condition. (That is usually called "introsort", for "introspective sort".) This example doesn't really do shellsort justice either, since it uses horrible intervals and thus makes many more passes than necessary.

    • @mandolinic
      @mandolinic 5 лет назад +2

      @@stanrogers5613 Thanks, Stan. You make good points. Most quick sorts use the end element as the pivot, which is a poor choice when (almost) sorted. I'm suggesting using the centre element instead.... but I suppose I'll have to put my money where my mouth is and code it up. No doubt, I'll discover that I'm wrong :-(

  • @majestoony
    @majestoony 4 года назад +3

    Its not lsd in place base 10
    Therefore it is beneath me.
    There can only be 1 sorting algorithm.
    It can only be led in place base 10

    • @squashedoranges7949
      @squashedoranges7949 2 года назад

      Using base 10 is a terrible idea, especially considering it requires the use of div instructions. The most practical is to use base 256, as it means you can simply read the whole byte without the need of any div instructions. Also lsd in place radix uses much more time than it's worth.

  • @okboing
    @okboing 4 года назад +5

    I wonder if it is possible to sort a list of any size by randomly picking two numbers and swapping if they are out of order?

    • @terradasher
      @terradasher 4 года назад +7

      Glorified bogo

    • @Malenbolai
      @Malenbolai 2 года назад +1

      @@terradasher bogo but smarter

    • @toddkes5890
      @toddkes5890 2 года назад

      Technically possible, but there is no guarantee after each swap that you have finished sorting the list. Assuming 10 elements and only 2 elements are not in sorted order, you have a 1 in 45 chance of picking them. (1 in 10 chance of picking one of the two unsorted elements, 1 in 9 of picking the other unsorted element, * 2 because it won't matter the order)
      For a 100-long list with only 2 elements not in sorted order, it is 1 in 4950 (1 in 100, 1 in 99, *2)

    • @algodoomarbleracing
      @algodoomarbleracing 2 года назад

      It’s called Exchange Bogo Sort.

  • @johngeverett
    @johngeverett 2 года назад +2

    I implemented Shell sort in 8080 assembler back in 1980 on an Apple ][+ with a Z-80 coprocessor with CP/M. In-memory. Ran like a scalded cat! And, yes, this is a Shell sort. Never heard of 'comb sort', but the logic is evidently similar enough to give some of you a wedgy over the terminology.

    • @SuperfieldCrUn
      @SuperfieldCrUn 2 года назад

      It's not shell sort. Shell sort is insertion sort, but with gaps larger than 1 that get smaller over time and eventually reach 1. Comb sort is bubble sort, but with gaps larger than 1 that get smaller over time and eventually reach 1.

    • @johngeverett
      @johngeverett 2 года назад

      @@SuperfieldCrUn not worth arguing over.

  • @ikkuku4655
    @ikkuku4655 2 года назад

    6 years ago... still watch this lol

  • @rishabhbhatnagar6795
    @rishabhbhatnagar6795 6 лет назад +14

    How are the elements distributed (along which axis)??

    • @toddkes5890
      @toddkes5890 6 лет назад +5

      Location left-right is their current order in the list, height is their value

  • @punpkin-314-pi5
    @punpkin-314-pi5 6 лет назад +7

    isn’t that comb sort? correct me if i’m wrong.

  • @s3xy131tch
    @s3xy131tch 8 лет назад +16

    what software/program did you use to make this video? would be interested in trying it out myself. love the video

    • @ThatGuy-nv2wo
      @ThatGuy-nv2wo 8 лет назад

      Wasn't me, but why not use pretty much any graphics library under the sun?
      I used SDL to create my own things, which, like most libraries, has a draw line and draw point function.

    • @s3xy131tch
      @s3xy131tch 8 лет назад

      okay, thanks :)

    • @TutukaBk
      @TutukaBk 6 лет назад

      Think it can be made with processing too

    • @PappuShankar
      @PappuShankar 6 лет назад

      Me too

  • @RamiCrafy
    @RamiCrafy 4 года назад

    Comments: [insert comments about sorts and stuff]
    Me: haha funny line go mmmmm */*

  • @zlodevil426
    @zlodevil426 2 года назад +1

    Where sorting noises

  • @brentfisher902
    @brentfisher902 4 года назад +1

    Let me guess, you made this song with PaulStretch...

  • @Slinx92OLD
    @Slinx92OLD 5 лет назад +2

    95% This is comb sort!
    5% Other comments

  • @kingcatthethird
    @kingcatthethird 6 месяцев назад

    This is comb sort, a n log base 1.3 n sort

  • @ahmidahmid9303
    @ahmidahmid9303 6 лет назад +2

    the first sort is not shell sort its comb sort

  • @astro_cat030
    @astro_cat030 2 года назад

    Wrong. Its like insertion sort not bubble sort. Comb sort is like bubble.

  • @TheHeartOfTheEvil
    @TheHeartOfTheEvil 8 лет назад +10

    C'è qualquadra che non cosa

  • @want-diversecontent3887
    @want-diversecontent3887 7 лет назад +4

    Shellsort is *_rad_*

  • @eksortso
    @eksortso 3 года назад

    This is wrong. Comb sorting is shown, not shellsorting.

  • @mocaothi7383
    @mocaothi7383 2 года назад

    Dude, is that a Combsort or a Shellsort?

  • @sharkPause1
    @sharkPause1 3 года назад

    this is comb sort

  • @DatGamer56
    @DatGamer56 5 лет назад +3

    Comb lmao

  • @lambdastudios4083
    @lambdastudios4083 6 лет назад +1

    Heh. My last name is Parsons. Neat video.

  • @偽88
    @偽88 8 лет назад +2

    thats soo fucking smart

  • @zydanemikael34
    @zydanemikael34 2 года назад

    wth is going on

    • @bitonic589
      @bitonic589 Год назад

      What you are watching is a sort visualization of "shell sort". It's actually not shell sort, this is comb sort.

  • @mikyjo2012
    @mikyjo2012 5 лет назад

    Isr