Commit 2378d823 authored by Rameesh's avatar Rameesh

add basic implementation

parent 1326b5aa
File added
vector<int> sort_custom( vector<int> );
\ No newline at end of file
#include"sorting.h"
#include<iostream>
using namespace std;
int main(){
int n;
vector<int> vin;
vector<int> vout;
cin >> n;
for (int i = 1; i <= n; i++){
int temp;
cin >>temp;
vin.push_back(temp);
}
vout=sort_custom(vin);
for (auto i = vout.begin(); i != vout.end(); ++i)
cout << *i << " ";
}
\ No newline at end of file
#include<vector>
using namespace std;
vector<int> sort_custom(vector<int> v){
int i, j;
int n=v.size();
for (i = 0; i < n-1; i++){
for (j = 0; j < n-i-1; j++){
if (v[j] > v[j+1]){
int temp;
temp=v[j];
v[j]=v[j+1];
v[j+1]=temp;
}
}
}
return v;
}
\ No newline at end of file
#include<vector>
using namespace std;
vector<int> sort_custom( vector<int> );
\ No newline at end of file
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