/******************************************************* * Copyright (C) 2015 Haotian Wu * * This file is the solution to the question: * https://www.hackerrank.com/challenges/insertionsort1 * * Redistribution and use in source and binary forms are permitted. *******************************************************/ #include #include #include #include #include #include #include #include using namespace std; int main() { // Check if it is less than the smallest element in the sorted array. int n,arr[1000]; scanf("%d",&n); for (int i=0;i=0;i--) { if (tmp >= arr[i]) { for (int j=0;j<=i;j++) printf("%d ",arr[j]); printf("%d ",tmp); for (int j=i+1;j