Loading collection data...
Collections are a way for you to organize kata so that you can create your own training routines. Every collection you create is public and automatically sharable with other warriors. After you have added a few kata to a collection you and others can train on the kata contained within the collection.
Get started now by creating a new collection.
Thanks again for the insightful explanation. It is also very interesting to see how qsort is implemented in glibc.
Despite its name, the C standard does not mandate that implementations of
qsort()
use the quicksort algorithm. In fact, it does not even require aO(n log n)
complexity forqsort()
, though of course most clibs will make it as fast as possible because it is an important function. So you cannoy rely on its stability.That being said, it seems like the glibc standard library (the one used on Codewars, which runs on Linux) uses mergesort in most cases; and "most merge sort implementations produce a stable sort". Do not rely on it though, it is an implementation detail. If you need a stable sort, make it stable yourself, e.g. by comparing the pointers themselves in case of structural equality.
This comment is hidden because it contains spoiler information about the solution
very clever man
.
Still an issue 3 years later.
See my reply above.
This comment is hidden because it contains spoiler information about the solution
The
pos
range is very important (all submitted solutions rely on the fact thatpos
is not very large). I restored thepos
range in the description.This comment is hidden because it contains spoiler information about the solution
This comment is hidden because it contains spoiler information about the solution
Okay, thanks for the feedback :)
The new kata looks good. I think that ranges of
a
andn
are sufficient. It should not be a performance kata.I suggest to unpublish this kata.
I published the new kata according to what @Kacarott pointed out.
In my opinion it is OK for different languages to have slightly different return types if it is more ideomatic for that language. Python could return a
Fraction
and other languages without fraction types could return tuples. The initial solution could make it clear what the return type should be.Loading more items...