SlideShare a Scribd company logo
6
Most read
7
Most read
8
Most read
Merge Sort
MERGE SORT
Nikhil R S USN: 1BM15IS051
K. Sai Supreeth USN:1BM15IS034
Topics to be covered:
■ Introduction
■ Definition
■ Algorithm
■ Steps involved
■ Program
■ Applications
Introduction:
■ Merge Sort is a complex and fast sorting
algorithm that repeatedly divides an un-
sorted section into two equal sub-
sections, sorts them separately and
merges them correctly.
Definition:
■ Merge sort is a DIVIDE AND CONQUER
algorithm. It divides input array in two
halves, calls itself for the two halves and
then merges the two sorted halves.The
merge() function is used for merging two
halves.
Steps involved:
– Divide the problem into sub-problems that
are similar to the original but smaller in size.
– Conquer the sub-problems by solving them
recursively. If they are small enough, just
solve them in a straightforward manner.
– Combine the solutions to create a solution to
the original problem.
Algorithm:
mergeSort(arr[], l, r)
If l < r
1. Find the middle point to divide the array into
two halves: middle m = (l+r)/2
2. Call mergeSort for first half: Call
mergeSort(arr, l, m)
3. Call mergeSort for second half: Call
mergeSort(arr, m+1, r)
4. Merge the two halves sorted in step 2 and 3:
Call merge(arr, l, m, r)
Example:
Program:
Merge Sort
Merge Sort
Merge Sort
Output:
Why Merge Sort??
■ Compared to insertion sort merge sort is
faster.
■ On small inputs, insertion sort may be faster.
But for large enough inputs, merge sort will
always be faster, because its running time
grows more slowly than insertion sorts.
■ Merge sort type algorithms allows large data
sets to be sorted easily.
■ Merge sort accesses data sequentially and the
need of random access is low.
■ Inversion count problem.
■ Used in External Sorting.
Applications:
■ Organize an MP3 library.
■ Display Google PageRank results.
■ The e-commerce application.
ThankYou...!!!!
Merge Sort

More Related Content

PPTX
Merge sort algorithm
PPTX
Quick sort
PPTX
Sorting Algorithms
PPTX
Merge sort algorithm power point presentation
PPTX
Quick sort-Data Structure
PPT
Merge sort
PPTX
Radix sort presentation
PPTX
Insertion Sorting
Merge sort algorithm
Quick sort
Sorting Algorithms
Merge sort algorithm power point presentation
Quick sort-Data Structure
Merge sort
Radix sort presentation
Insertion Sorting

What's hot (20)

PPTX
Doubly Linked List
PPTX
Data structure - Graph
PPT
Binary Search
PPT
Time complexity
PPTX
B and B+ tree
PPTX
Linear search-and-binary-search
PPT
1.1 binary tree
PPTX
Binary search
PPTX
Priority Queue in Data Structure
PPT
Data Structures- Part5 recursion
PPTX
Selection sorting
PPTX
PPTX
Binary Tree Traversal
PPTX
Breadth First Search & Depth First Search
PPTX
Greedy Algorithms
PDF
Binary Search - Design & Analysis of Algorithms
DOC
Time and space complexity
PPT
Bubble sort
PPTX
Insertion sort algorithm power point presentation
PPTX
Tree Traversal
Doubly Linked List
Data structure - Graph
Binary Search
Time complexity
B and B+ tree
Linear search-and-binary-search
1.1 binary tree
Binary search
Priority Queue in Data Structure
Data Structures- Part5 recursion
Selection sorting
Binary Tree Traversal
Breadth First Search & Depth First Search
Greedy Algorithms
Binary Search - Design & Analysis of Algorithms
Time and space complexity
Bubble sort
Insertion sort algorithm power point presentation
Tree Traversal
Ad

Viewers also liked (20)

PPTX
Merge sort
PPTX
Merge sort
PPTX
Merge sort code in C explained
PDF
Merge sort: illustrated step-by-step walk through
PPTX
Presentation-Merge Sort
PPTX
Law powerpoint
PPT
портфоліо вч міщенко о.л.
PPTX
PDF
136_147_Fashion_Story
PPTX
кріт і нірки
PPT
портфоліо вч міщенко о.л.
DOCX
Clase 2 Energía no renovable
DOC
TECHICIAN cv
PPTX
Educacion electronica
PPTX
The View of Buddhism & Science with reference
PPTX
Atividade pratica de educação fisica
PPTX
Hipervínculos
PDF
SGEFF The Singapore Eco Film Festival
Merge sort
Merge sort
Merge sort code in C explained
Merge sort: illustrated step-by-step walk through
Presentation-Merge Sort
Law powerpoint
портфоліо вч міщенко о.л.
136_147_Fashion_Story
кріт і нірки
портфоліо вч міщенко о.л.
Clase 2 Energía no renovable
TECHICIAN cv
Educacion electronica
The View of Buddhism & Science with reference
Atividade pratica de educação fisica
Hipervínculos
SGEFF The Singapore Eco Film Festival
Ad

Similar to Merge Sort (20)

PPTX
Presentation merge sort.pptx
PPTX
DSA- Merge Sort-a sorting technique.pptx
PPTX
Data Structure Marge sort Group 5 pptx so
PPTX
24671A08972ds.pptxxxxxxxxxkkkskjsjsjskskssjdhdjskw
PPTX
Data structure Merge Sort implementation
PDF
advanced algo
PPTX
2010990716_Tamanna Asija.pptx
PPTX
merg sort slide created by anas sanan.pptx
PPTX
presentation.pptx
PPTX
MergeSort presentation dgdfgdfgdfgg.pptx
PPTX
Marge Sort
PPTX
Merge sort
PPTX
dsa presentation on merge sorting in C++.pptx
PPTX
Merj sort
PPTX
Merge sort
PPTX
Merge Sort (w/ principle, algorithm, code, visualizations)
PPT
Merge sort
PPTX
Data Structures and Agorithm: DS 20 Merge Sort.pptx
PPTX
slidesgo-mastering-merge-sort-efficient-sorting-techniques-for-modern-applica...
Presentation merge sort.pptx
DSA- Merge Sort-a sorting technique.pptx
Data Structure Marge sort Group 5 pptx so
24671A08972ds.pptxxxxxxxxxkkkskjsjsjskskssjdhdjskw
Data structure Merge Sort implementation
advanced algo
2010990716_Tamanna Asija.pptx
merg sort slide created by anas sanan.pptx
presentation.pptx
MergeSort presentation dgdfgdfgdfgg.pptx
Marge Sort
Merge sort
dsa presentation on merge sorting in C++.pptx
Merj sort
Merge sort
Merge Sort (w/ principle, algorithm, code, visualizations)
Merge sort
Data Structures and Agorithm: DS 20 Merge Sort.pptx
slidesgo-mastering-merge-sort-efficient-sorting-techniques-for-modern-applica...

Recently uploaded (20)

PDF
Digital Logic Computer Design lecture notes
PDF
Model Code of Practice - Construction Work - 21102022 .pdf
PDF
Structs to JSON How Go Powers REST APIs.pdf
PPTX
Internet of Things (IOT) - A guide to understanding
PPT
Project quality management in manufacturing
PDF
Mitigating Risks through Effective Management for Enhancing Organizational Pe...
PPTX
web development for engineering and engineering
PDF
PPT on Performance Review to get promotions
DOCX
573137875-Attendance-Management-System-original
PDF
composite construction of structures.pdf
PPTX
Lesson 3_Tessellation.pptx finite Mathematics
PPTX
UNIT 4 Total Quality Management .pptx
PPTX
OOP with Java - Java Introduction (Basics)
PDF
Well-logging-methods_new................
PDF
BMEC211 - INTRODUCTION TO MECHATRONICS-1.pdf
PDF
July 2025 - Top 10 Read Articles in International Journal of Software Enginee...
PDF
PRIZ Academy - 9 Windows Thinking Where to Invest Today to Win Tomorrow.pdf
DOCX
ASol_English-Language-Literature-Set-1-27-02-2023-converted.docx
PPTX
Sustainable Sites - Green Building Construction
PDF
Arduino robotics embedded978-1-4302-3184-4.pdf
Digital Logic Computer Design lecture notes
Model Code of Practice - Construction Work - 21102022 .pdf
Structs to JSON How Go Powers REST APIs.pdf
Internet of Things (IOT) - A guide to understanding
Project quality management in manufacturing
Mitigating Risks through Effective Management for Enhancing Organizational Pe...
web development for engineering and engineering
PPT on Performance Review to get promotions
573137875-Attendance-Management-System-original
composite construction of structures.pdf
Lesson 3_Tessellation.pptx finite Mathematics
UNIT 4 Total Quality Management .pptx
OOP with Java - Java Introduction (Basics)
Well-logging-methods_new................
BMEC211 - INTRODUCTION TO MECHATRONICS-1.pdf
July 2025 - Top 10 Read Articles in International Journal of Software Enginee...
PRIZ Academy - 9 Windows Thinking Where to Invest Today to Win Tomorrow.pdf
ASol_English-Language-Literature-Set-1-27-02-2023-converted.docx
Sustainable Sites - Green Building Construction
Arduino robotics embedded978-1-4302-3184-4.pdf

Merge Sort

  • 2. MERGE SORT Nikhil R S USN: 1BM15IS051 K. Sai Supreeth USN:1BM15IS034
  • 3. Topics to be covered: ■ Introduction ■ Definition ■ Algorithm ■ Steps involved ■ Program ■ Applications
  • 4. Introduction: ■ Merge Sort is a complex and fast sorting algorithm that repeatedly divides an un- sorted section into two equal sub- sections, sorts them separately and merges them correctly.
  • 5. Definition: ■ Merge sort is a DIVIDE AND CONQUER algorithm. It divides input array in two halves, calls itself for the two halves and then merges the two sorted halves.The merge() function is used for merging two halves.
  • 6. Steps involved: – Divide the problem into sub-problems that are similar to the original but smaller in size. – Conquer the sub-problems by solving them recursively. If they are small enough, just solve them in a straightforward manner. – Combine the solutions to create a solution to the original problem.
  • 7. Algorithm: mergeSort(arr[], l, r) If l < r 1. Find the middle point to divide the array into two halves: middle m = (l+r)/2 2. Call mergeSort for first half: Call mergeSort(arr, l, m) 3. Call mergeSort for second half: Call mergeSort(arr, m+1, r) 4. Merge the two halves sorted in step 2 and 3: Call merge(arr, l, m, r)
  • 14. Why Merge Sort?? ■ Compared to insertion sort merge sort is faster. ■ On small inputs, insertion sort may be faster. But for large enough inputs, merge sort will always be faster, because its running time grows more slowly than insertion sorts.
  • 15. ■ Merge sort type algorithms allows large data sets to be sorted easily. ■ Merge sort accesses data sequentially and the need of random access is low. ■ Inversion count problem. ■ Used in External Sorting. Applications:
  • 16. ■ Organize an MP3 library.
  • 17. ■ Display Google PageRank results. ■ The e-commerce application.