Commit 44a1e97d authored by RAMOLLA NIKHIL REDDY's avatar RAMOLLA NIKHIL REDDY

change implementation to insertion-sort

parent 6a5d2ec6
#include "sorting.h"
using namespace std;
vector<int> sort_custom(vector<int> arr){
int N=arr.size();
for(int i=0;i<N;i++)
for(int j=0;j<N-i-1;j++)
return arr;
vector<int> sort_custom(vector<int> data) {
int N = data.size(), j;
for(int i=0; i<N; i++) {
for(j=0; j<i; j++) if(data[j] > data[i]) break;
for(; j<i; j++) swap(data[j], data[i]);
return data;
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment