Steps on how it works:
- If it is the first element, it is already sorted.
- Pick the next element
- Compare with all the elements in sorted sub-list.
- Shift all the the elements in sorted sub-list that is greater than the value to be sorted to the right side.
- Insert the value.
- Repeat until list is sorted.
No comments:
Post a Comment