3
I have a question about recursiveness. Actually, I’m not understanding how it works. Come on! I have the following function:
void MergeSort (int *V, int inicio, int fim) {
int meio;
if (inicio < fim) {
meio = floor ((inicio + fim) /2);
MergeSort (V, inicio, meio);
MergeSort (V, meio+1, fim);
merge (V, inicio, meio, fim);
}
}
My question is the recursive function call MergeSort. Even when he keeps calling the first function MergeSort(V, inicio, meio) and when it stops and starts calling the second function MergeSort( v, meio +1, fim).
I understand the following.
void MergeSort (int *V, int inicio, int fim) {
int meio;
if (inicio < fim) {
meio = floor ((inicio + fim) /2);
MergeSort (V, inicio, meio); // chama novamente essa funcao. Pare a função que esta sendo executada
int meio;
if (inicio < fim) {
meio = floor ((inicio+meio)/2)
mergesort (V, inicio, meio) //chama novamente essa funcao. Pare a função que esta sendo executada
}
}
}
At what point in the program it would stop calling the function MergeSort (V, inicio , meio) and call the function MergeSort (V, meio+1, fim) ?

Missing finish the keys to the
if (inicio < fim) {– David Schrammel
There is still some doubt about the question?
– Guilherme Lautert