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.
Nah, that's what we call cheating. I just forgor about the variable name. Technically, it's the same code. Imma write python minifier some time.
nice!. how about the next more advanced kumite. where the knight makes 2 moves instead of just one. Im publishing it today...
You lose ~ 56 chars!😜
I think you're right, master. Why do we need to care about perfomance in a knight move task? I have no idea, but we still do it.
guys, just stop focusing on performances on something that does not require any kind of performances. You have mostly no idea what you're measuring there.
all this is O(1): there are always exactly 3 elements to sort anyway. And talking big O when N is not bg has absolutely no sense.
Gotcha! ehehehehhe
Looks real, I believe it, thanks :3
Good catch! According to StackOverflow,
O(n) + O(n log(n)) = O(n log(n))
. For Big O complexity, all that matters is the dominant term.n log(n)
dominatesn
in this situation therefore, that's the only term that matters (source).I have a stupid question: When
n
is a constant, should we use is? ahhahahaYes, but time complexity of
sorted()
is O(n*log(n)) because behind used Timsort alg.edited or I miss understood something XD
edited 1 and it is 5 loops i think
The time complexity of the
map()
function isO(n)
.Okey ghost watcher, thx
The reason that we don't use constants with big O notation is because, theoretically they don't matter much. What we are calculating with time-complexity is the speed at which something will grow, having a constant on there will be completely irrelevant when a large enough input is used
Now I think it's O(1) or O(3n)
edit
I'm not remember what alg used in sorted func of python
edit 1
O(1) or O(n*log(n))
Why not use? Constant values affect the speed of program execution, a program using 2 loops instead of one will run slower.
Loading more items...