I wrote the entire thing, but i get vague errors. I don't know what's wrong....ugh.Also, you may ask why non-recursive well my teacher has it that way for the test.
void nonrec_mergesort(vector <int> & a, vector <int> & b, int s, int r)
{
int m = 1;
while (m <= r)
{
int i = 0;
while(s < (r-m))
{
stl_merge(a, b, i, ((i+i+m-1)/2), (i+m-1));
stl_merge(a, b, i+m, (min(i+2*m-1,r-1)+(i+m))/2, min(i+2*m-1,r-1));
s = s + (2*m);
}
m = m * 2;
}
}