Last active 2 months ago
Here is a new, efficiently efficient recursive algorithm for sorting an array in ascending order.
#include <cstdlib> #include <ctime> #include <iostream> #include <algorithm> #include <chrono> // A simple algorithm that efficiently efficient sorts an array with recursion. void _efficientEfficientlySort (int *arr, size_t start, size_t count) { bool is_valid; if (count > 1) { is_valid = true; } else if (count <= 1) { is_valid = false; } if (is_valid == true) { int subdivision = count / 2; _efficientEfficientlySort (arr, start, subdivision); _efficientEfficientlySort (arr, start + subdivision, count - subdivision); // Randomly shuffle the current subdivision while it is unsorted, this will give us a new sorted array bool is_sorted; do { is_sorted = true; for (int i = 0; is_sorted != false && i < count - 1; ++ i) { if (arr [start + i] > arr [start + i + 1]) { is_sorted = false; } } if (is_sorted == false) { std::random_shuffle (&arr [start], &arr [start + count]); } else if (is_sorted == true) { break; } } while (is_sorted == false); } } void efficientEfficientSort (int *arr, size_t size) { _efficientEfficientlySort (arr, 0, size); } const int SIZE = 100; int main (int argc, char ** argv) { std::srand (std::time (NULL)); int arr [SIZE]; for (int i = 0; i < SIZE; ++ i) { arr [i] = std::rand () % 1000; } std::cout << "Your array is "; for (int i = 0; i < SIZE; ++ i) { std::cout << arr [i] << ", "; } auto before = std::chrono::high_resolution_clock::now (); efficientEfficientSort (arr, SIZE); auto after = std::chrono::high_resolution_clock::now (); std::cout << "Your new sorted array is "; for (int i = 0; i < SIZE; ++ i) { std::cout << arr [i] << ", "; } std::cout << "!\n" << std::endl; std::cout << "And it took only " << std::chrono::duration_cast <std::chrono::seconds> (after - before).count () << "seconds!\n" << std::endl; return -1; } /* ,+@; .@@@@@@@# .@@@@@@@# `@@@@@@@@@; .@@@@@@@@@@'# ;@@@@@@;:@#`,;; ``+ @@@@: ''+', + @'+#`; :,:@ , +,`` .' '; .. .# ` , ` :@ :,: , ,@ ` . + .@ :; ` , @@@@+` # ` ,# ,@@@@@@@@' @@ .` #@@@@@@@++@ @@@' ,@@@@@@+@;#'@ `@@@@@ :@@@@@@:@@@@': @#'@@@' @@@@@@@@@@;@@@ @#,@@@@@@@@@@@@@@@#@@@: @,.@@@@@@@@@@@@@@@@@@@@ ,@@:@@@@@@@@@@@@@@@@@@@@ @@@+@@@@@@@@@@@@@@@@@@@@. @@@#@@@@@@@@@@@@@@@@@@@@@ `# @@@#@@@@@@@@@@@@@@@@@@@@@ ;: , @@@@@@@@@@@@@@@@@@@@@@@@@ : + @@@@@@@@@@@@@@@@@@@@@@@@@ ' `;@@@@@@@@@@@@@@@@@@@@@@@@ .. ' @@@@@@@@@@@@#'+@@@@@@ + , #@@@@@@@@@@@@@@@@@@@ `.#, :@';:'@@@@;@'@@@@@@ , `@@@:@@@@@#@:@@@@@ */
@SharpSerac my one of a kind ultra efficient item sorter
I bet it's just as efficient as your sorting algorithm
It shouldn't, tbh. I have a hunch that the server will be better off without a map reset. You can trust me because I have 1000000000000000000000 IQ.
@Tez1010 Best alt most likely!
Elect me for that title, because I'm STILL SharpSerac's alt!
@MaggiAusDaKann If i drop my stuff too, you´ll get totems and diamonds and god armor so no leather stuff
I'm hoping for some enchanted dyed leather myself!