Ranter
Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
Comments
-
Wow, down voted over a sorting algorithm. Guess to be a true dev I'm supposed to pick the fastest sorting algorithm as my favorite, whatever I like bubbles.
-
@Haxk20 Read about computational complexity. Big-Oh analysis of algorithm efficiency. It's definitely worth your time. (I'm actually happy to be the first to introduce this to you)
-
@Haxk20 I'll tell you, being only 17 and implementing select sort on your own without knowing is a good sign, keep at it my friend.
-
@Haxk20 the O as in the letter "Oh" is just a convention, it doesn't denote a function as it seems
-
Root797737yRadix sort.
How it works is really quite neat, and sounds amazing if you play a tone for each access/write!
Or, less seriously: random sort! 😊
O(1) best case
O(n^n) average case... -
I can't recall the name, but here it is:
def sort(arr):
return [12, 36, 42, 190, 547] -
Root797737y@Letmecode
While you should always use the best algo for the job, or the one with the best runtime benchmark, some sorting algos are just really interesting. -
Quantum sort. The only O(n) sorting algorithm.
Use a true random generator to create a random sort index. If items aren't in order, discard the current universe. All possible arrangements will exist but in different universes. Which means that the list will be ordered. -
PysKa512157ySelection/Insertion/Bubble sort when it doesn't really matter.
QuickSort fine tuned to use O(log n) of stack memory when both speed and memory are important.
MergeSort when memory is not so important but speed is. -
This sort
function sort(initial_array) {
var ret = [1,2,3,4,5];
return ret; //there sorted done
}
I love it because it's an O(1) algorithm :^) -
mhudson12937yMerge sort is really graceful, I think it's pretty.
But I usually use quick sort 'cause it's fast. -
@PysKa512 O(n*log(n))
Very few and only the best algorithms solve any problem in O(log(n)) complexity, and neither of them relates to sorting. -
Hope Sort. Just throw in the numbers and hope they will sort themselves eventually.
-
@apisarenco O(n log n) time complexity, and O(log n) stack space. Time complexity =/= space complexity
-
@apisarenco it doesn't matter because you never explicitly store the entire binary tree in the stack - just one path which is O(log n)
Favorite sorting algorithm?
undefined