## Sorting with animation

Started by Mikl__, December 30, 2022, 09:02:57 AM

#### HSE

Fantastic
Equations in Assembly: SmplMath

#### jj2007

Quote from: Mikl__ on January 18, 2023, 12:49:21 AM
Fifth part

Hi Mikl,

Sounds good but I can't see an animation, and the "translated" zip archive isn't found...

QuoteA multiple run through the array is performed, neighboring elements are compared and, if necessary, swapped. When the end of the array is reached, the direction is reversed. While moving to the beginning of the array, we find the maximum element and change it with the element that is at the end of the array. This pushes the minimum element to the beginning of the array. While moving to the end of the array, we find the minimum element and change it with the element that is at the beginning of the array. In this case, the maximum element is pushed to the end of the array. Thus, simultaneously during one pass, the maximum and minimum elements of the end and beginning of the array are filled.

https://en.wikipedia.org/wiki/Cocktail_shaker_sort

#### HSE

Hi JJ!

Just now I realise how was that:

Equations in Assembly: SmplMath

#### zedd151

lol. I had never heard of that sorting algorithm before (cocktail shaker sort). But I once made a sorting algorithm that I called a bidirectional sort which worked very similarly (reversing direction, etc)  if not very slowly.
Nice graphic of its implementation. Thankfully I had stopped experimenting with home brew sorting algos in favor of tried and trued methods, which of course are always much faster than anything I could dream up. It was fun though.
Regards, zedd...

#### jj2007

Quote from: HSE on January 18, 2023, 01:46:28 AM
Hi JJ!

Just now I realise how was that:

Thanks, Hector, works like a charm

#### Mikl__

QuoteSounds good but I can't see an animation, and the "translated" zip archive isn't found...
Hi jj2007!
This is especially for you!

Thanks, Mikl

#### jj2007

Very nice animation, Mikl