Commit 2c47e1f5 authored by Neeraj Kerkar's avatar Neeraj Kerkar

update merge-sort to reflect API update

parent 2b3f2357
......@@ -42,7 +42,7 @@ vector<int> merge(const vector<int>& left, const vector<int>& right)
return result;
vector<int> sort_custom(vector<int> vec)
vector<int> merge_sort(vector<int> vec)
// Termination condition: List is completely sorted if it
// only contains a single element.
......@@ -58,9 +58,19 @@ vector<int> sort_custom(vector<int> vec)
vector<int> right(middle, vec.end());
// Perform a merge sort on the two smaller vectors
left = sort_custom(left);
right = sort_custom(right);
left = merge_sort(left);
right = merge_sort(right);
return merge(left, right);
vector<int> sort_custom(vector<int> a,int start,int end){
vector<int> b;
for(int i=0;i<a.size();i++){
if(i>=start || i<=end){
return merge_sort(b);
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