ritikbanger / Hacktoberfest2022-DSA

If You know the implementation of any DSA related topic/problem or HackerRank, HackerEarth, LeetCode problems then you can contribute it in this repo. Raise Genuine PRs only. Your PRs will be accepted, keep patience. Star this Repo. You aren't allowed to Update README.md. Create PR and win Swags in hacktoberfest 2022
MIT License
97 stars 340 forks source link

Wrote a code for merge sort in C# #494

Open DhruvTotala opened 1 month ago

DhruvTotala commented 1 month ago

The provided C# code implements the Merge Sort algorithm, which follows a divide-and-conquer approach. The Sort() function recursively splits the array into two halves until the base case of a single element is reached. The Merge() function then combines the two sorted halves by comparing elements from both subarrays and copying the smaller ones back into the original array. The process continues recursively until the entire array is sorted. The Main() function demonstrates the algorithm on a sample array, printing both the unsorted and sorted arrays. Merge Sort has a time complexity of O(n log n) and is stable.

DhruvTotala commented 1 month ago

@ritikbanger review this code