Insertion Sort, Algorithms, Data Structure Algorithm, Coding Interviews, Job Hunting.
sorted array. As we can see 5 is smaller than 6 so we shift the 6 to one position ahead and place 5 before 6. Now our sorted array will become 5 6. After that, we will update the key to 3. Now, we will compare this key = 3 with the elements of the sorted array and place it to its correct position.