Skip to content

MergeSort.java#402

Open
MUSKAN-GARG1108 wants to merge 1 commit intoshikaruki:mainfrom
MUSKAN-GARG1108:patch-1
Open

MergeSort.java#402
MUSKAN-GARG1108 wants to merge 1 commit intoshikaruki:mainfrom
MUSKAN-GARG1108:patch-1

Conversation

@MUSKAN-GARG1108
Copy link

Merge Sort is a divide-and-conquer algorithm. It divides the input array into two halves, calls itself the two halves, and then merges the two sorted halves. The merge() function is used for merging two halves. The merge(arr, l, m, r) is a key process that assumes that arr[l..m] and arr[m+1..r] are sorted and merges the two sorted sub-arrays into one.

Merge Sort Algorithm
There are only five steps to understand Merge Sort Algorithm:

Step 1: Divide Array into Two Parts
Step 2: Merge Sort the first part of the array
Step 3: Merge Sort the second part of the array
Step 4: Merge Both the parts
Step 5: Return the Sorted Array

The base Condition for Merge Sort is :
Divide the Array till the size of the Array is greater than 1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant