Close
Topic list
MEDIUM
10 mins
Sorting
Topics (Covered in this problem)
Problem solved
Skill meter
-
-
Sorting
-
-
Other topics
Problem solved
Skill meter
Strings
-
-
Matrices (2D Arrays)
-
-
Binary Search
-
-
Stacks & Queues
-
-
Trees
-
-
Graph
-
-
Dynamic Programming
-
-
Greedy
-
-
Tries
-
-
Arrays
-
-
SQL
-
-
Binary Search Trees
-
-
Heap
-
-
Bit Manipulation
-
-
Solve problems & track your progress
Checkout your overall progress in every topic here
Become
Sensei
in DSA topics
Open the topic and solve more problems associated with it to improve your skills
Check out the skill meter for every topic
See how many problems you are left with to solve for cracking any stage. Score more than zero to get your progress counted.

Contributed by
Prashansa
Medium
0/80
Avg time to solve 10 mins
Success Rate 90 %
Share

## Problem Statement

#### Merge Sort is a Divide and Conquer algorithm. It divides the input into two halves, calls itself for 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 subarrays into one.

Detailed explanation ( Input/output format, Notes, Constraints, Images )
##### Sample Input 1:
``````3
1 -2 3 -1
9 9 -1
4 -1
``````
##### Sample Output 1:
``````-2 1 3 -1
9 9 -1
4 -1
``````
##### Explanation For Sample Output 1:
``````For every test case, the sorted list is printed, terminated by -1.
``````
##### Sample Input 2:
``````2
1 1 1 -1
3 -3 -1
``````
##### Sample Output 2:
``````1 1 1 -1
-3 3 -1
``````
Auto
Console