| Topic | Difficulty | Companies |
|---|---|---|
| Iteration and Two Pointer Approach | MEDIUM |
Given an array of integers arr[] of size n, Write a program to sort the array in ascending order using Insertion Sort.
Example 1
Input: arr[] = [5, 2, 3, 1]
Output: [1, 2, 3, 5]
Explanation: [5, 2, 3, 1] when sorted in ascending order gives [1, 2, 3, 5]
Example 2
Input: arr[] = [5, 1, 1, 2, 0, 0]
Output: [0, 0, 1, 1, 2, 5]
Explanation: [5, 1, 1, 2, 0, 0] when sorted in ascending order gives [0, 0, 1, 1, 2, 5].