Merge Sort Algorithm with practical program in C

Article by: Manish Methani

Last Updated: October 9, 2021 at 2:04pm IST
2 mins 51 sec read

What is merge sort ?

Merge sort is divide and conquer sorting algorithm . Merge procedure is the heart of algorithm. Given two sorted arrays of size M & N, merge procedure will create a new sorted array of size M + N.

How Merge Sort works ?

Consider an array of 5 elements (2,5,4,1,3) . Merge sort can be visualised in three phases :

1) Divide.

2) Conquer.

3) Combine.

 

 

1) In the given example, the given array is split into two smaller arrays. Now, these two smaller arrays will recursively split themselves further into smaller arrays till only one element is left in an array. This phase is called as Divide Phase. In the given diagram, as you can see on the fourth step, each element is split in its own individual array.

 

 

2) Now in Conquer Phase merge procedure will combine these arrays in ascending order.

3) Now in Combined Phase these smaller sorted arrays will merge together to form a single sorted array of original size.

Learn Flutter, FlutterFlow,
Firebase & Angular.

Looking to learn how to create the production-ready apps
from scratch? Well, you are at the right place.

₹1299 or $15.56

Learn to create the Dating App using No-Code Tool FlutterFlow

Level: Advanced

Explore Curriculum
₹1299 or $15.56

Flutter Mobile App Development Course

Explore Curriculum
₹1299 or $15.56

The Complete Angular Course

Explore Curriculum
₹1299 or $15.56

Dart Programming for Absolute Beginners

Coming Soon
FREE

Next.js course

Start Watching
FREE

Fundamentals of Computer Programming Languages

Start Watching
FREE

Learn HTML, CSS & Bootstrap

Start Watching

Latest Web Stories

1

Learn how to open WhatsApp using FlutterFlow | Step by Step Guide

Test your skills with these expert-led curated
Mock Tests.

C Programming Test

Test your C Programming skills with this comprehensive mock test on C Programming.

Take Test

Flutter Test

Solve most asked Interview Questions on Flutter and Test your foundational skills in flutter.

Take Test

GATE(CSE) Operating Systems

Solve most asked GATE Questions in Operating Systems and test your Gate Score.

Take Test

HTML,CSS Test

This is a mock test designed to help you assess your knowledge and skills in HTML and CSS.

Take Test

(GATE CSE) Data Structures & Algorithms Test

Solve most asked GATE Questions in Data Structures and Algorithms and test your Gate Score.

Take Test

Download the Codzify
Mobile App


Learn Anytime, Anywhere at your own pace. Scan the QR Code with your Mobile Camera to Download the Codzify Mobile App.

Codzify Mobile App Codzify Mobile App
Codzify Logo

Terms and Conditions    Cookie Policy   Refund Policy   Adsense Disclaimer