I'm experiencing a "sequence not ordered" error when this code is executed and I'm not sure why. Any help would be appreciated, thanks.

void merge_sort(vector<int>& v, int from, int to, vector<int>& a){
	 if(from == to) return;
	 int mid = (from + to) / 2;
	 
	 merge_sort(v, from, mid, a);
	 merge_sort(v, mid + 1, to, a);
	 merge(v.begin(), v.begin() + mid, v.begin() + mid, v.begin() + to, a.begin());
}

Suggest you read this explaintion and example I don't think you need all that recursion.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.