5
Most read
12
Most read
Submitted to- Submitted by-
Mrs. Randeep Bhatia Ms. kajal sharma
(AP in cs dept) MCA5th sem
1718781
SORTING
Sorting and searching are the two most common
operations performed on data stored in
Computers . Most of the data structures that we
have studied so far are primarily designed to make
sorting and searching easier and more efficient on
the data stored in the structure.
sorting refers to the process
of arranging data in a particular order such as
ascending or descending order . An ascending
sort of five integers{20,10,60,45,25}produces
{10,20,25,45,60}where as descending sort produces
{60,45,25,20,10}.
The main objective of sorting is to organize
the data so meaningful .
Methods of sorting
• Internal sorting-In Internal sorting ,all of the data which
is to be sorted can be held in primary memory(ram) during
the sorting algorithms.
• External sorting-In external sorting ,all the data to be
sorted can’t be held in the primary memory at one time of
the data has to be sorted in secondary storage devices
such as hard disk, floppy disk etc.
Types of sorting
• Insertion sort .
• Selection sort .
• Merge sort .
• Heap sort .
• Radix sort .
• Bubble sort .
Time complexity of merge sort
F(n)=o(nlog2n)
Merge sort
Merge sort is a well known sorting algorithm
invented by john von Neumann in 1945.It is based
on the divide and conquer strategy in which we
divide the data into smaller pieces , recursively
conquer each piece and merge the result until the
original list is rebuild to a sorted one .
The merge sort algorithm divides the given
list to be sorted into two subsists of approximately
half size , sorts each subsists independently and
then merge the two subsists into a single sorted list.
Original list
We begin merge sort by first dividing the original
array into two sub arrays of approximately equal size.
Thus we divide the array into sub arrays as follows
Original list is divided into two halves
Example :-
our aim is to sort each sub array so that it can be
merged later. Now consider the left sub array
which is again divided into two sub arrays as
Left sub array subdivided into two halves
To each of these sub arrays again apply the same
method that divides each of these into sub arrays of
one element each
Merging of sub arrays
Right sub array subdivided into two halves
our aim is to sort each sub array so that it can be
merged later. Now consider the left sub array which
is again divided into two sub arrays as
To each of these sub arrays again apply the same
method that divides each of these into sub
arrays of one element each
Dividing technique
Merging technique
Advantages
• It can be applied to files of any size.
• Reading of the input during the run –creation
step is sequential.
• If heap sort is used for the in-memory part of
the merge ,its operation can be overlapped.
Disadvantages
• It requires extra space.
• Merge sort requires more space than other
sort.
• Merge sort is less efficient than other sort.
Merge sort

More Related Content

PPTX
Binary search
PPT
Selection sort
PPTX
Quick Sort
PPTX
Selection sort and insertion sort
PPTX
Python-Inheritance.pptx
PPTX
Selection sorting
PPTX
Doubly linked list (animated)
PPTX
Divide and conquer - Quick sort
Binary search
Selection sort
Quick Sort
Selection sort and insertion sort
Python-Inheritance.pptx
Selection sorting
Doubly linked list (animated)
Divide and conquer - Quick sort

What's hot (20)

PDF
Algorithms Lecture 4: Sorting Algorithms I
PPTX
PPTX
Presentation-Merge Sort
PPTX
Priority queue in DSA
PPTX
Threaded Binary Tree.pptx
PPT
Linked list
PPTX
Binary Tree in Data Structure
PPT
Parsing
PPT
Quick sort data structures
PPTX
Trees (data structure)
PPTX
Binary Search Tree
PPTX
Linear and Binary search
PPTX
Insertion sort
PPT
Sorting algorithms
PPS
Single linked list
PPTX
PPTX
linked list
PPTX
linked list in data structure
PPTX
Insertion sort
Algorithms Lecture 4: Sorting Algorithms I
Presentation-Merge Sort
Priority queue in DSA
Threaded Binary Tree.pptx
Linked list
Binary Tree in Data Structure
Parsing
Quick sort data structures
Trees (data structure)
Binary Search Tree
Linear and Binary search
Insertion sort
Sorting algorithms
Single linked list
linked list
linked list in data structure
Insertion sort
Ad

Similar to Merge sort (20)

PPTX
Daa final
PPTX
Merge sort analysis and its real time applications
PPTX
Merge sort
PPTX
Merge Sort (w/ principle, algorithm, code, visualizations)
PPTX
Data structure Merge Sort implementation
PPTX
Mergesort
PPTX
MergeSort in data structure and its applications.pptx
PPTX
Marge Sort
PPTX
merg sort slide created by anas sanan.pptx
PPTX
Merj sort
PPTX
DSA- Merge Sort-a sorting technique.pptx
DOCX
Merge sort lab mannual
PPTX
sorting-160810203705.pptx
PPTX
Merge sort
PPTX
Presentation merge sort.pptx
PPTX
Sorting types and Algorithms
PPTX
Sorting
PPTX
All Searching and Sorting Techniques in Data Structures
PPTX
2.Problem Solving Techniques and Data Structures.pptx
PPT
Data Structures 7
Daa final
Merge sort analysis and its real time applications
Merge sort
Merge Sort (w/ principle, algorithm, code, visualizations)
Data structure Merge Sort implementation
Mergesort
MergeSort in data structure and its applications.pptx
Marge Sort
merg sort slide created by anas sanan.pptx
Merj sort
DSA- Merge Sort-a sorting technique.pptx
Merge sort lab mannual
sorting-160810203705.pptx
Merge sort
Presentation merge sort.pptx
Sorting types and Algorithms
Sorting
All Searching and Sorting Techniques in Data Structures
2.Problem Solving Techniques and Data Structures.pptx
Data Structures 7
Ad

Recently uploaded (20)

PDF
BP 704 T. NOVEL DRUG DELIVERY SYSTEMS (UNIT 1)
PPTX
Climate Change and Its Global Impact.pptx
PPTX
Module on health assessment of CHN. pptx
PDF
Myanmar Dental Journal, The Journal of the Myanmar Dental Association (2013).pdf
PDF
Race Reva University – Shaping Future Leaders in Artificial Intelligence
PDF
English Textual Question & Ans (12th Class).pdf
PDF
FOISHS ANNUAL IMPLEMENTATION PLAN 2025.pdf
PDF
LIFE & LIVING TRILOGY- PART (1) WHO ARE WE.pdf
PDF
Vision Prelims GS PYQ Analysis 2011-2022 www.upscpdf.com.pdf
PDF
Hazard Identification & Risk Assessment .pdf
DOCX
Cambridge-Practice-Tests-for-IELTS-12.docx
PDF
LIFE & LIVING TRILOGY - PART - (2) THE PURPOSE OF LIFE.pdf
PDF
Environmental Education MCQ BD2EE - Share Source.pdf
PDF
Journal of Dental Science - UDMY (2020).pdf
PDF
Climate and Adaptation MCQs class 7 from chatgpt
PDF
Empowerment Technology for Senior High School Guide
PPTX
Core Concepts of Personalized Learning and Virtual Learning Environments
PDF
MBA _Common_ 2nd year Syllabus _2021-22_.pdf
PDF
Skin Care and Cosmetic Ingredients Dictionary ( PDFDrive ).pdf
PDF
BP 505 T. PHARMACEUTICAL JURISPRUDENCE (UNIT 1).pdf
BP 704 T. NOVEL DRUG DELIVERY SYSTEMS (UNIT 1)
Climate Change and Its Global Impact.pptx
Module on health assessment of CHN. pptx
Myanmar Dental Journal, The Journal of the Myanmar Dental Association (2013).pdf
Race Reva University – Shaping Future Leaders in Artificial Intelligence
English Textual Question & Ans (12th Class).pdf
FOISHS ANNUAL IMPLEMENTATION PLAN 2025.pdf
LIFE & LIVING TRILOGY- PART (1) WHO ARE WE.pdf
Vision Prelims GS PYQ Analysis 2011-2022 www.upscpdf.com.pdf
Hazard Identification & Risk Assessment .pdf
Cambridge-Practice-Tests-for-IELTS-12.docx
LIFE & LIVING TRILOGY - PART - (2) THE PURPOSE OF LIFE.pdf
Environmental Education MCQ BD2EE - Share Source.pdf
Journal of Dental Science - UDMY (2020).pdf
Climate and Adaptation MCQs class 7 from chatgpt
Empowerment Technology for Senior High School Guide
Core Concepts of Personalized Learning and Virtual Learning Environments
MBA _Common_ 2nd year Syllabus _2021-22_.pdf
Skin Care and Cosmetic Ingredients Dictionary ( PDFDrive ).pdf
BP 505 T. PHARMACEUTICAL JURISPRUDENCE (UNIT 1).pdf

Merge sort

  • 1. Submitted to- Submitted by- Mrs. Randeep Bhatia Ms. kajal sharma (AP in cs dept) MCA5th sem 1718781
  • 2. SORTING Sorting and searching are the two most common operations performed on data stored in Computers . Most of the data structures that we have studied so far are primarily designed to make sorting and searching easier and more efficient on the data stored in the structure. sorting refers to the process of arranging data in a particular order such as ascending or descending order . An ascending sort of five integers{20,10,60,45,25}produces
  • 3. {10,20,25,45,60}where as descending sort produces {60,45,25,20,10}. The main objective of sorting is to organize the data so meaningful . Methods of sorting • Internal sorting-In Internal sorting ,all of the data which is to be sorted can be held in primary memory(ram) during the sorting algorithms. • External sorting-In external sorting ,all the data to be sorted can’t be held in the primary memory at one time of the data has to be sorted in secondary storage devices such as hard disk, floppy disk etc.
  • 4. Types of sorting • Insertion sort . • Selection sort . • Merge sort . • Heap sort . • Radix sort . • Bubble sort . Time complexity of merge sort F(n)=o(nlog2n)
  • 5. Merge sort Merge sort is a well known sorting algorithm invented by john von Neumann in 1945.It is based on the divide and conquer strategy in which we divide the data into smaller pieces , recursively conquer each piece and merge the result until the original list is rebuild to a sorted one . The merge sort algorithm divides the given list to be sorted into two subsists of approximately half size , sorts each subsists independently and then merge the two subsists into a single sorted list.
  • 6. Original list We begin merge sort by first dividing the original array into two sub arrays of approximately equal size. Thus we divide the array into sub arrays as follows Original list is divided into two halves Example :-
  • 7. our aim is to sort each sub array so that it can be merged later. Now consider the left sub array which is again divided into two sub arrays as Left sub array subdivided into two halves To each of these sub arrays again apply the same method that divides each of these into sub arrays of one element each
  • 8. Merging of sub arrays Right sub array subdivided into two halves our aim is to sort each sub array so that it can be merged later. Now consider the left sub array which is again divided into two sub arrays as
  • 9. To each of these sub arrays again apply the same method that divides each of these into sub arrays of one element each Dividing technique
  • 11. Advantages • It can be applied to files of any size. • Reading of the input during the run –creation step is sequential. • If heap sort is used for the in-memory part of the merge ,its operation can be overlapped.
  • 12. Disadvantages • It requires extra space. • Merge sort requires more space than other sort. • Merge sort is less efficient than other sort.