Hi! I'm writing the mergesort algorithm, theoretically everything is fine in it but when the function gets to call itself the program crashes. I belive that I'm doing something worng when I pass the vector<int> as a parameter to the function.

**procedure mergesort(T[1 .. n]) if n is small then insert(T) else arrays U[1 .. n div 2], V[1 .. (n+1) div 2] U <- T[1 .. n div 2] V <- T[1 + (n div 2) .. n] mergesort(U); mergesort(V) merge(T, U, V)**

```
void mergeSort(vector<int>& mass){
if(mass.size() <= 16)
sort(mass.begin(),mass.end());
else {
vector<int> u,v;
int size1,size2;
size1 = div(mass.size(),2).quot;
size2 = div(mass.size()+1,2).quot;
u.resize(size1);
v.resize(size2);
u.assign(mass.begin(),mass.end()-size1);
v.assign(mass.begin()+size1+1,mass.end());
mergeSort(u);
mergeSort(v);
mass.clear();
merge(u.begin(),u.end(),v.begin(),v.end(),mass.begin());
}
};
```

Can anyone tell me what I'm doing wrong?