Insertion Sort

easy
1. Implement insertion sort.

Input Format

First line contains N. Second line contains N space separated integers.

Output Format

Print the sorted array

Constraints

1 <=N<= 1000
 1 <=arr[i]<= 1000

Notice

Try First, Check Solution later

1. You should first read the question and watch the question video.
2. Think of a solution approach, then try and submit the question on editor tab.
3. We strongly advise you to watch the solution video for prescribed approach.

Example

Input
5
4 1 3 9 7
Output
1 3 4 7 9
Previous
Bubble Sort
Next
Merge Two Sorted Arrays

Related Questions