ghostmkg / programming-language

You write code in any programming language you want. And push the code.
33 stars 79 forks source link

Create Merge_Sort.cpp #85

Closed AK261102 closed 1 day ago

AK261102 commented 1 day ago

What does this PR do? This PR implements the Merge Sort algorithm in C++ using vectors. It includes a function for merging two subarrays and recursively sorting the array. The program reads input from the user, sorts the vector using merge sort, and outputs both the original and sorted vector.

Test Plan I tested the program with multiple input sizes and sequences, including edge cases such as: Empty input (n = 0). Single-element input. Pre-sorted and reverse-sorted inputs. Random sequences of numbers. Verified the program correctly outputs the original and sorted vectors. All unit tests passed successfully, and manual testing confirmed that the program handles different input sizes and edge cases without errors. Related PRs and Issues No related PRs or issues.

Have you read the Contributing Guidelines on issues? Yes, I have read and followed the contributing guidelines.