#include<iostream>
using namespace std;
int main(){
int a[]={112,23,4,5,56,7};
cout<<"The array before sorting is"<<endl;
for(int i=0;i<n;i++){
cout<<a[i]<<" ";
}
cout<<endl;
for (int i=1;i<n;i++){
int j;
for(j
=i
-1;j
>=0&&a
[j
]>key;j
--){ a[j+1]=a[j];
}
}
cout<<"The sorted array is"<<endl;
for(int i=0;i<n;i++){
cout<<a[i]<<" ";
}
]
I2luY2x1ZGU8aW9zdHJlYW0+CnVzaW5nIG5hbWVzcGFjZSBzdGQ7CmludCBtYWluKCl7CiAgICBpbnQgYVtdPXsxMTIsMjMsNCw1LDU2LDd9OwogICAgaW50IG4gPSBzaXplb2YgKGEpL3NpemVvZiAoYVswXSk7CiAgICBjb3V0PDwiVGhlICBhcnJheSBiZWZvcmUgc29ydGluZyBpcyI8PGVuZGw7CiAgICBmb3IoaW50IGk9MDtpPG47aSsrKXsKICAgICAgICBjb3V0PDxhW2ldPDwiICI7CiAgICB9CiAgICBjb3V0PDxlbmRsOwogICAgZm9yIChpbnQgaT0xO2k8bjtpKyspewogICAgICAgIGludCBrZXk9YVtpXTsKICAgICAgICBpbnQgajsKICAgICAgICBmb3Ioaj1pLTE7aj49MCYmYVtqXT5rZXk7ai0tKXsKICAgICAgICAgICAgYVtqKzFdPWFbal07CiAgICAgICAgfQogICAgICAgIGFbaisxXT1rZXk7CiAgICB9CiAgICBjb3V0PDwiVGhlIHNvcnRlZCBhcnJheSBpcyI8PGVuZGw7CiAgICBmb3IoaW50IGk9MDtpPG47aSsrKXsKICAgICAgICBjb3V0PDxhW2ldPDwiICI7CiAgICB9CiAgICBd