Skip to content

Latest commit

 

History

History
24 lines (13 loc) · 760 Bytes

File metadata and controls

24 lines (13 loc) · 760 Bytes

Challenge 26 - Insertion Sort

Challenge Description

Implement an insertion sort function that sorts a numbered array

Approach & Efficiency

Iterate the array. Using a for loop. Have a temp variable. Using a while loop, Compare that value against previous items in the array. On each compare, keep pushing the items, forward in the array until the temp variable is no longer less than the value being compared. At the end, reassign the empty spot with the temp Array

Space: O(1) Time: 0(n^2)

Solution

UML