Commit 8bf0f1d2 authored by Aneesh Shetty's avatar Aneesh Shetty

add program to sort numbers

parent b0c78a80
#include "sorting.h"
#include <iostream>
#include <vector>
using namespace std;
vector<int> sort_custom( vector<int> a )
{
for(int i=0;i<a.size();i++)
{
int flag=0;
for(int j=1;j<a.size();j++)
{
if(a[j]<a[j-1])
{
flag=1;
int temp=a[j];
a[j]=a[j-1];
a[j-1]=temp;
}
}
if(flag==0)
break;
}
return a;
}
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