Merge sort(problem)


merge sort problem.Its showing TLE can you check my code.

@bommareddyjyothiswaroopreddy
The code is working absolutely fine. The only issue I could find was that you shouldnt initialize the arrays to zero as it is not at all required because we are already handling the required areas using the variables s and e and hence, there is no issue of a garbage value creeping in. Also temp array is getting declared everytime the merge function is called. It will be better if you declare it as a global variable.

This is the modified code.

Try this out once and let me know if the issue still persists.

If my explanation solves your query, please mark the doubt as resolved.

1 Like