Memory Management: Used dynamic memory allocation for temporary arrays in the merge function, ensuring flexibility and avoiding stack overflow for large arrays.
Simplified Logic: Removed unnecessary variables and streamlined the code for readability.
Cleaner Insertion Sort: The insertion sort logic was refined to ensure it operates within the specified bounds.
Consistent Naming: Ensured that variable names are clear and meaningful, improving readability.
Improved Output: Added formatting in the output to make it clearer.
Memory Management: Used dynamic memory allocation for temporary arrays in the merge function, ensuring flexibility and avoiding stack overflow for large arrays. Simplified Logic: Removed unnecessary variables and streamlined the code for readability. Cleaner Insertion Sort: The insertion sort logic was refined to ensure it operates within the specified bounds. Consistent Naming: Ensured that variable names are clear and meaningful, improving readability. Improved Output: Added formatting in the output to make it clearer.