SlideShare a Scribd company logo
1 of 10
1
Sharmin Sultana Jeesa
ID#141-15-3219
Dept: CSE
Course Code: CSE221
2
3
* The key to Merge Sort is merging two sorted lists
into one, suchthat if you have two lists L1= {3, 8, 9}
& L2= {1, 5, 7} then the sorted array will be, merge(L1,
L2) = {1, 3, 5, 7, 8, 9}.
* Time complexity of merge sort is O(n log₂n).
* Double storage neededto hold the array to be
sorted.
4
5
*Invented by John von
Neumann (1903-1957).
*Follows divide and
conquer approach.
* Divide: Divide the unsortedlist intotwo sub lists of
about half the size.
* Conquer: Sort each of the two sub lists recursively until
we have list sizes of length 1, in which case the list itself is
returned.
* Combine: Merge the two-sortedsub lists back into one
sorted list.
6
5 8 4 2 6 3 0 1 7
7
5 8 4 2 6 3 0 1 7
5 8 4 2 6 3 0 1 7
85
5 8 4 2 6 3 0 1 7
0 1 2 3 4 5 6 7 8
8
2 4 5 6 8 0 1 3 7
5 8 4 2 6 3 0 1 7
85
4 5 8 2 6 0 3 1 7
MERGE
Merge sort’s merge operation is useful in online
sorting, where the list to be sorted is received a
piece at a time, instead of all at the beginning.
In this We sort each new piece that is received using
any sorting algorithm, and then merge it into our
sorted list so far using the merge operation.
9
10

More Related Content

More from JeeSa Sultana (7)

Vlsm js
Vlsm  jsVlsm  js
Vlsm js
 
Frquency distribution & graphs js
Frquency distribution & graphs jsFrquency distribution & graphs js
Frquency distribution & graphs js
 
Semiconductor js
Semiconductor jsSemiconductor js
Semiconductor js
 
Bellmanfordwith negative cycle js
Bellmanfordwith negative cycle jsBellmanfordwith negative cycle js
Bellmanfordwith negative cycle js
 
Sir jagdish chandra bose
Sir jagdish chandra boseSir jagdish chandra bose
Sir jagdish chandra bose
 
Expression evaluation
Expression evaluationExpression evaluation
Expression evaluation
 
Nature of light
Nature of lightNature of light
Nature of light
 

Recently uploaded

Salient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functionsSalient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functions
KarakKing
 

Recently uploaded (20)

Plant propagation: Sexual and Asexual propapagation.pptx
Plant propagation: Sexual and Asexual propapagation.pptxPlant propagation: Sexual and Asexual propapagation.pptx
Plant propagation: Sexual and Asexual propapagation.pptx
 
Food safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdfFood safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdf
 
This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.
 
REMIFENTANIL: An Ultra short acting opioid.pptx
REMIFENTANIL: An Ultra short acting opioid.pptxREMIFENTANIL: An Ultra short acting opioid.pptx
REMIFENTANIL: An Ultra short acting opioid.pptx
 
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdf
 
Exploring_the_Narrative_Style_of_Amitav_Ghoshs_Gun_Island.pptx
Exploring_the_Narrative_Style_of_Amitav_Ghoshs_Gun_Island.pptxExploring_the_Narrative_Style_of_Amitav_Ghoshs_Gun_Island.pptx
Exploring_the_Narrative_Style_of_Amitav_Ghoshs_Gun_Island.pptx
 
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
 
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdfUGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
 
Salient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functionsSalient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functions
 
General Principles of Intellectual Property: Concepts of Intellectual Proper...
General Principles of Intellectual Property: Concepts of Intellectual  Proper...General Principles of Intellectual Property: Concepts of Intellectual  Proper...
General Principles of Intellectual Property: Concepts of Intellectual Proper...
 
Towards a code of practice for AI in AT.pptx
Towards a code of practice for AI in AT.pptxTowards a code of practice for AI in AT.pptx
Towards a code of practice for AI in AT.pptx
 
On_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptx
On_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptxOn_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptx
On_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptx
 
How to setup Pycharm environment for Odoo 17.pptx
How to setup Pycharm environment for Odoo 17.pptxHow to setup Pycharm environment for Odoo 17.pptx
How to setup Pycharm environment for Odoo 17.pptx
 
ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.
 
Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024
 
How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17
 
Jamworks pilot and AI at Jisc (20/03/2024)
Jamworks pilot and AI at Jisc (20/03/2024)Jamworks pilot and AI at Jisc (20/03/2024)
Jamworks pilot and AI at Jisc (20/03/2024)
 
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptxHMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
 
NO1 Top Black Magic Specialist In Lahore Black magic In Pakistan Kala Ilam Ex...
NO1 Top Black Magic Specialist In Lahore Black magic In Pakistan Kala Ilam Ex...NO1 Top Black Magic Specialist In Lahore Black magic In Pakistan Kala Ilam Ex...
NO1 Top Black Magic Specialist In Lahore Black magic In Pakistan Kala Ilam Ex...
 

Merge sort js

  • 1. 1
  • 2. Sharmin Sultana Jeesa ID#141-15-3219 Dept: CSE Course Code: CSE221 2
  • 3. 3
  • 4. * The key to Merge Sort is merging two sorted lists into one, suchthat if you have two lists L1= {3, 8, 9} & L2= {1, 5, 7} then the sorted array will be, merge(L1, L2) = {1, 3, 5, 7, 8, 9}. * Time complexity of merge sort is O(n log₂n). * Double storage neededto hold the array to be sorted. 4
  • 5. 5 *Invented by John von Neumann (1903-1957). *Follows divide and conquer approach.
  • 6. * Divide: Divide the unsortedlist intotwo sub lists of about half the size. * Conquer: Sort each of the two sub lists recursively until we have list sizes of length 1, in which case the list itself is returned. * Combine: Merge the two-sortedsub lists back into one sorted list. 6
  • 7. 5 8 4 2 6 3 0 1 7 7 5 8 4 2 6 3 0 1 7 5 8 4 2 6 3 0 1 7 85 5 8 4 2 6 3 0 1 7
  • 8. 0 1 2 3 4 5 6 7 8 8 2 4 5 6 8 0 1 3 7 5 8 4 2 6 3 0 1 7 85 4 5 8 2 6 0 3 1 7 MERGE
  • 9. Merge sort’s merge operation is useful in online sorting, where the list to be sorted is received a piece at a time, instead of all at the beginning. In this We sort each new piece that is received using any sorting algorithm, and then merge it into our sorted list so far using the merge operation. 9
  • 10. 10