Merge Sort: A Detailed Analysis of the Merge Sort Algorithm, Slides of Data Structures and Algorithms

An in-depth exploration of merge sort, a popular sorting algorithm developed by john von neumann in 1945. The merging process, the merge algorithm, and the divide and conquer approach. It also includes examples and comparisons between in-place and double storage implementations, as well as an analysis of the algorithm's time complexity.

Typology: Slides

2012/2013

Uploaded on 04/30/2013

dinpal
dinpal 🇮🇳

3.6

(12)

73 documents

1 / 28

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
Merge Sort
Docsity.com
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff
pf12
pf13
pf14
pf15
pf16
pf17
pf18
pf19
pf1a
pf1b
pf1c

Partial preview of the text

Download Merge Sort: A Detailed Analysis of the Merge Sort Algorithm and more Slides Data Structures and Algorithms in PDF only on Docsity!

Merge Sort

In the Beginning…

John von Neumann (1903-1957)

  • Stored program
  • Developed merge sort for EDVAC in 1945

Merging (cont.)

  • The merge Algorithm: From The Art of Computer Programming vol2: Sorting and Searching by Donald E. Knuth (page 160).

Merging (cont.)

X: 3 10 23 54 Y: 1 5 25 75

Result:

Merging (cont.)

X: Y:

Result:

Merging (cont.)

X: Y:

Result:

Merging (cont.)

X: Y:

Result:

Merging (cont.)

X: Y:

Result:

Merging (cont.)

X: Y:

Result:

Divide And Conquer

  • Merging a two lists of one element each is the same as sorting them.
  • Merge sort divides up an unsorted list until the above condition is met and then sorts the divided parts back together in pairs.
  • Specifically this can be done by recursively dividing the unsorted list in half, merge sorting the right side then the left side and then merging the right and left back together.

Merge Sort Example

Merge Sort Example

Merge Sort Example

Merge Sort Example