Syntax doubt in the code

In this code can we combine line 39 and 40 to write the following code:
return bubble_sort_recursive(a,j+1, n);

would it mean the same??

yes @anshufirefox you can also do it like that. It would mean the same.

Thank you for helping :slight_smile:

Similarly here in line 47 and 48, why haven’t we used return statement with the merge_sort function calls? Is the return thing happening by default here?

As the merge_sort function is of void data type, so there’s no need of any return statement. Moreover your base case will take you out of recursion.

if i write return in 47 and 48, will it be syntax error?

you won’t get syntax error, but your recursion won’t work favorably. As soon as it will encounter the return statement of line 47, it won’t execute return statement of 48. But we want it to work simultaneously. That’s why we are not using return statement. Just calling the function instead :slight_smile:

Thank you so much
:smile:

If this solves your doubt, please mark it as resolved

Sure, Thanks again. Would you like me to give a rating somewhere? If it helps

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.