Commit d857b114 authored by ARPIT AGGARWAL's avatar ARPIT AGGARWAL

update merge-sort to reflect API update

parent 2fac559b
...@@ -54,7 +54,7 @@ void mergeSort(int arr[], int l, int r) ...@@ -54,7 +54,7 @@ void mergeSort(int arr[], int l, int r)
} }
} }
vector<int> sort_custom(vector<int> data) vector<int> sort_custom(vector<int> data, int startidx, int endidx)
{ {
//vector<int> arr(data.begin(), data.end()) ; //vector<int> arr(data.begin(), data.end()) ;
int n = data.size() ; int n = data.size() ;
...@@ -63,7 +63,7 @@ vector<int> sort_custom(vector<int> data) ...@@ -63,7 +63,7 @@ vector<int> sort_custom(vector<int> data)
{ {
arr[i] = data[i] ; arr[i] = data[i] ;
} }
mergeSort(arr,0,n-1) ; mergeSort(arr, startidx, endidx - 1) ;
vector<int> res(arr, arr+n) ; vector<int> res(arr, arr + n) ;
return res ; return res ;
} }
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