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.
made it a lot shorter though the speed is similar due to the fact that yours inserts the value which is slower
Time measurement confirms my hypothesis:
divisors1 4.6103479569997035
divisors3 4.21220756699995
divisors4 4.539421095999842
divisors5 3.7151190190002126
Insert is O(n) (because we have to shift every element after insertion point), so total runtime for list construction will be O(n*n), where n is number of factors. Sort, on the other hand, should be O(n*log(n)), which is asymptotically faster.
guys you have to find all prime numbers that divides this number first this will increase esentially time efficiency
Good one! I'll compare the runtimes with mine.