Coding Quiz - Implement Insertion Sort
Based on what you've learned so far, implement the insertion sort
algorithm yourself.
Write your code here
def solution(numbers):
# Write your code here
return
Constraints
-
numbers
is a list containing numbers. -
The
length of the list
must be at least 1.
Examples
-
Input:
[6, 5, 3, 1, 8, 7, 2, 4]
-
Output:
[1, 2, 3, 4, 5, 6, 7, 8]
-
Input:
[3, 1, 4, 1, 5]
-
Output:
[1, 1, 3, 4, 5]
Want to learn more?
Join CodeFriends Plus membership or enroll in a course to start your journey.