際際滷

際際滷Share a Scribd company logo
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 logn).
* 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 sorts 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
Ad

More Related Content

More from JeeSa Sultana (7)

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

Recently uploaded (20)

Engage Donors Through Powerful Storytelling.pdf
Engage Donors Through Powerful Storytelling.pdfEngage Donors Through Powerful Storytelling.pdf
Engage Donors Through Powerful Storytelling.pdf
TechSoup
YSPH VMOC Special Report - Measles Outbreak Southwest US 4-30-2025.pptx
YSPH VMOC Special Report - Measles Outbreak  Southwest US 4-30-2025.pptxYSPH VMOC Special Report - Measles Outbreak  Southwest US 4-30-2025.pptx
YSPH VMOC Special Report - Measles Outbreak Southwest US 4-30-2025.pptx
Yale School of Public Health - The Virtual Medical Operations Center (VMOC)
Grade 3 - English - Printable Worksheet (PDF Format)
Grade 3 - English - Printable Worksheet  (PDF Format)Grade 3 - English - Printable Worksheet  (PDF Format)
Grade 3 - English - Printable Worksheet (PDF Format)
Sritoma Majumder
B畛 畛 TUY畛N SINH VO L畛P 10 TI畉NG ANH - 25 畛 THI BM ST C畉U TRC M畛I NH畉T, ...
B畛 畛 TUY畛N SINH VO L畛P 10 TI畉NG ANH - 25 畛 THI BM ST C畉U TRC M畛I NH畉T, ...B畛 畛 TUY畛N SINH VO L畛P 10 TI畉NG ANH - 25 畛 THI BM ST C畉U TRC M畛I NH畉T, ...
B畛 畛 TUY畛N SINH VO L畛P 10 TI畉NG ANH - 25 畛 THI BM ST C畉U TRC M畛I NH畉T, ...
Nguyen Thanh Tu Collection
Real GitHub Copilot Exam Dumps for Success
Real GitHub Copilot Exam Dumps for SuccessReal GitHub Copilot Exam Dumps for Success
Real GitHub Copilot Exam Dumps for Success
Mark Soia
Grade 2 - Mathematics - Printable Worksheet
Grade 2 - Mathematics - Printable WorksheetGrade 2 - Mathematics - Printable Worksheet
Grade 2 - Mathematics - Printable Worksheet
Sritoma Majumder
Metamorphosis: Life's Transformative Journey
Metamorphosis: Life's Transformative JourneyMetamorphosis: Life's Transformative Journey
Metamorphosis: Life's Transformative Journey
Arshad Shaikh
THE STG QUIZ GROUP D.pptx quiz by Ridip Hazarika
THE STG QUIZ GROUP D.pptx   quiz by Ridip HazarikaTHE STG QUIZ GROUP D.pptx   quiz by Ridip Hazarika
THE STG QUIZ GROUP D.pptx quiz by Ridip Hazarika
Ridip Hazarika
Understanding PN Junction Semiconductors: A Beginners Guide
Understanding PN Junction Semiconductors: A Beginners GuideUnderstanding PN Junction Semiconductors: A Beginners Guide
Understanding PN Junction Semiconductors: A Beginners Guide
GS Virdi
To study Digestive system of insect.pptx
To study Digestive system of insect.pptxTo study Digestive system of insect.pptx
To study Digestive system of insect.pptx
Arshad Shaikh
Kasdorf "Accessibility Essentials: A 2025 NISO Training Series, Session 5, Ac...
Kasdorf "Accessibility Essentials: A 2025 NISO Training Series, Session 5, Ac...Kasdorf "Accessibility Essentials: A 2025 NISO Training Series, Session 5, Ac...
Kasdorf "Accessibility Essentials: A 2025 NISO Training Series, Session 5, Ac...
National Information Standards Organization (NISO)
One Hot encoding a revolution in Machine learning
One Hot encoding a revolution in Machine learningOne Hot encoding a revolution in Machine learning
One Hot encoding a revolution in Machine learning
momer9505
Stein, Hunt, Green letter to Congress April 2025
Stein, Hunt, Green letter to Congress April 2025Stein, Hunt, Green letter to Congress April 2025
Stein, Hunt, Green letter to Congress April 2025
Mebane Rash
2541William_McCollough_DigitalDetox.docx
2541William_McCollough_DigitalDetox.docx2541William_McCollough_DigitalDetox.docx
2541William_McCollough_DigitalDetox.docx
contactwilliamm2546
CBSE - Grade 8 - Science - Chemistry - Metals and Non Metals - Worksheet
CBSE - Grade 8 - Science - Chemistry - Metals and Non Metals - WorksheetCBSE - Grade 8 - Science - Chemistry - Metals and Non Metals - Worksheet
CBSE - Grade 8 - Science - Chemistry - Metals and Non Metals - Worksheet
Sritoma Majumder
03#UNTAGGED. Generosity in architecture.
03#UNTAGGED. Generosity in architecture.03#UNTAGGED. Generosity in architecture.
03#UNTAGGED. Generosity in architecture.
MCH
K12 Tableau Tuesday - Algebra Equity and Access in Atlanta Public Schools
K12 Tableau Tuesday  - Algebra Equity and Access in Atlanta Public SchoolsK12 Tableau Tuesday  - Algebra Equity and Access in Atlanta Public Schools
K12 Tableau Tuesday - Algebra Equity and Access in Atlanta Public Schools
dogden2
Operations Management (Dr. Abdulfatah Salem).pdf
Operations Management (Dr. Abdulfatah Salem).pdfOperations Management (Dr. Abdulfatah Salem).pdf
Operations Management (Dr. Abdulfatah Salem).pdf
Arab Academy for Science, Technology and Maritime Transport
How to Manage Purchase Alternatives in Odoo 18
How to Manage Purchase Alternatives in Odoo 18How to Manage Purchase Alternatives in Odoo 18
How to Manage Purchase Alternatives in Odoo 18
Celine George
SCI BIZ TECH QUIZ (OPEN) PRELIMS XTASY 2025.pptx
SCI BIZ TECH QUIZ (OPEN) PRELIMS XTASY 2025.pptxSCI BIZ TECH QUIZ (OPEN) PRELIMS XTASY 2025.pptx
SCI BIZ TECH QUIZ (OPEN) PRELIMS XTASY 2025.pptx
Ronisha Das
Engage Donors Through Powerful Storytelling.pdf
Engage Donors Through Powerful Storytelling.pdfEngage Donors Through Powerful Storytelling.pdf
Engage Donors Through Powerful Storytelling.pdf
TechSoup
Grade 3 - English - Printable Worksheet (PDF Format)
Grade 3 - English - Printable Worksheet  (PDF Format)Grade 3 - English - Printable Worksheet  (PDF Format)
Grade 3 - English - Printable Worksheet (PDF Format)
Sritoma Majumder
B畛 畛 TUY畛N SINH VO L畛P 10 TI畉NG ANH - 25 畛 THI BM ST C畉U TRC M畛I NH畉T, ...
B畛 畛 TUY畛N SINH VO L畛P 10 TI畉NG ANH - 25 畛 THI BM ST C畉U TRC M畛I NH畉T, ...B畛 畛 TUY畛N SINH VO L畛P 10 TI畉NG ANH - 25 畛 THI BM ST C畉U TRC M畛I NH畉T, ...
B畛 畛 TUY畛N SINH VO L畛P 10 TI畉NG ANH - 25 畛 THI BM ST C畉U TRC M畛I NH畉T, ...
Nguyen Thanh Tu Collection
Real GitHub Copilot Exam Dumps for Success
Real GitHub Copilot Exam Dumps for SuccessReal GitHub Copilot Exam Dumps for Success
Real GitHub Copilot Exam Dumps for Success
Mark Soia
Grade 2 - Mathematics - Printable Worksheet
Grade 2 - Mathematics - Printable WorksheetGrade 2 - Mathematics - Printable Worksheet
Grade 2 - Mathematics - Printable Worksheet
Sritoma Majumder
Metamorphosis: Life's Transformative Journey
Metamorphosis: Life's Transformative JourneyMetamorphosis: Life's Transformative Journey
Metamorphosis: Life's Transformative Journey
Arshad Shaikh
THE STG QUIZ GROUP D.pptx quiz by Ridip Hazarika
THE STG QUIZ GROUP D.pptx   quiz by Ridip HazarikaTHE STG QUIZ GROUP D.pptx   quiz by Ridip Hazarika
THE STG QUIZ GROUP D.pptx quiz by Ridip Hazarika
Ridip Hazarika
Understanding PN Junction Semiconductors: A Beginners Guide
Understanding PN Junction Semiconductors: A Beginners GuideUnderstanding PN Junction Semiconductors: A Beginners Guide
Understanding PN Junction Semiconductors: A Beginners Guide
GS Virdi
To study Digestive system of insect.pptx
To study Digestive system of insect.pptxTo study Digestive system of insect.pptx
To study Digestive system of insect.pptx
Arshad Shaikh
One Hot encoding a revolution in Machine learning
One Hot encoding a revolution in Machine learningOne Hot encoding a revolution in Machine learning
One Hot encoding a revolution in Machine learning
momer9505
Stein, Hunt, Green letter to Congress April 2025
Stein, Hunt, Green letter to Congress April 2025Stein, Hunt, Green letter to Congress April 2025
Stein, Hunt, Green letter to Congress April 2025
Mebane Rash
2541William_McCollough_DigitalDetox.docx
2541William_McCollough_DigitalDetox.docx2541William_McCollough_DigitalDetox.docx
2541William_McCollough_DigitalDetox.docx
contactwilliamm2546
CBSE - Grade 8 - Science - Chemistry - Metals and Non Metals - Worksheet
CBSE - Grade 8 - Science - Chemistry - Metals and Non Metals - WorksheetCBSE - Grade 8 - Science - Chemistry - Metals and Non Metals - Worksheet
CBSE - Grade 8 - Science - Chemistry - Metals and Non Metals - Worksheet
Sritoma Majumder
03#UNTAGGED. Generosity in architecture.
03#UNTAGGED. Generosity in architecture.03#UNTAGGED. Generosity in architecture.
03#UNTAGGED. Generosity in architecture.
MCH
K12 Tableau Tuesday - Algebra Equity and Access in Atlanta Public Schools
K12 Tableau Tuesday  - Algebra Equity and Access in Atlanta Public SchoolsK12 Tableau Tuesday  - Algebra Equity and Access in Atlanta Public Schools
K12 Tableau Tuesday - Algebra Equity and Access in Atlanta Public Schools
dogden2
How to Manage Purchase Alternatives in Odoo 18
How to Manage Purchase Alternatives in Odoo 18How to Manage Purchase Alternatives in Odoo 18
How to Manage Purchase Alternatives in Odoo 18
Celine George
SCI BIZ TECH QUIZ (OPEN) PRELIMS XTASY 2025.pptx
SCI BIZ TECH QUIZ (OPEN) PRELIMS XTASY 2025.pptxSCI BIZ TECH QUIZ (OPEN) PRELIMS XTASY 2025.pptx
SCI BIZ TECH QUIZ (OPEN) PRELIMS XTASY 2025.pptx
Ronisha Das
Ad

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 logn). * 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 sorts 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