Professional Documents
Culture Documents
MERGE SORT
Session -7
To introduce students to the basic concepts merge sort and its algorithm
INSTRUCTIONAL OBJECTIVES
LEARNING OUTCOMES
Merge Sort
Merge sort is yet another sorting algorithm that falls under the category of Divide and Conquer technique.
It is one of the best sorting techniques that successfully build a recursive algorithm.
Merge Sort
Divide into
A FirstPart SecondPart
two halves
FirstPart SecondPart
Merge
A is sorted!
To know the functioning of merge sort, lets consider an array arr[] = {38,
27, 43, 3, 9, 82, 10}
• Quick-Sort
– Most of the work done in partitioning
– Best case takes O(n log(n)) time
– Average case takes O(n log(n)) time
– Worst case takes O(n2) time
• Merge-sort
All cases take O(n log(n)) time
a) backtracking
b) greedy algorithm
c) divide and conquer
d) dynamic programming
a) O(n log n)
b) O(n2)
c) O(n2 log n)
d) O(n log n2)
Reference Books:
1. Robert Sedgewick and Kevin wayne ,”Algorithms”, 4th edition,Addison Wesley Prof.,
(2011).
2. 2. Anny Levitin, “Introduction to Design and Analysis of Algorithms”, 2rd Edition, Person
Education Press. (2007).
3. 3. Michael T.Goodrich and Roberto Tamassia, Algorithm Design: Foundations, Analysis
and Internet Examples, Second Edition, Wiley-India, (200)6.
4. 4. Steven S. Skiena, “The Algorithm Design Manual”, Second Edition, Springer, (2008)
Sites and Web links:
5. https://www.javatpoint.com/daa-merge-sor
2. https://www.geeksforgeeks.org/merge-sort/
Team – DAA