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.
It seems to me that your algorithm is flawed - you do not perform a swap every single time regardless of conditions.
Take the list
[103, 87, 113]
for example:103
and87
. Since103
is indeed greater than87
we perform a swap.[87, 103, 113]
and we compare103
and113
. We only perform a swap if the number at the left hand side (103
) is greater than the number at the right hand side (113
). Since that is not the case, we do not perform a swap.[87, 103, 113]
.Hope that helps :)