Mean Sort

I made a new sorting algorithm in snap called mean sort, because it's based on means of lists. What it does is find the mean of a list, split the list by the mean, and then do the same thing for each list. The base condition is that if the length is 1, report the list. If the mean mod 1 is 0, put the mean between the 2 lists.
This sorting algorithm is a modified version of quicksort so that the pivot is the mean of the list. Therefore, the time complexity if O(n*log(n)) or O(log(n^n)) using a logarithm property.


Well, I rebuilt your block and for it the complexity of the time is because it checks the
other conditionals on it. I reduce it like this in my Super-Snap! mod. Look at the blocks! :wink:

Interesting approach. I guess it will work well if:

  1. addition is a meaningful operation for all items (e.g. it won't work with text strings);
  2. calculating the average is a fast operation ( :white_check_mark: );
  3. the distribution of values ​​is more or less symmetrical with respect to the mean; thus the mean is close to the median, and each of the subsets (left and right) is approximately the same size.