diff --git a/cpp/algorithms/insertionsort.cpp b/cpp/algorithms/insertionsort.cpp new file mode 100644 index 000000000..f07ceca71 --- /dev/null +++ b/cpp/algorithms/insertionsort.cpp @@ -0,0 +1,33 @@ +//INSERT SORT ALGORITHM IN C++ +#include +using namespace std; +int main() +{ + int n;cin>>n; + int a[n]; + + for(int i=0;i>a[i]; + + } + for(int i=1;icurrent && j>=0) + { + a[j+1]=a[j]; + j--; + } + a[j+1]=current; + } + + + + + for(int i=0;i