Array 8
Array 8
Case Complexity
Best Case O(n*logn)
Average Case O(n*logn)
Worst Case O(n*logn)
Continue..
• Best Case Complexity - It occurs when there is no sorting required, i.e. the
array is already sorted. The best-case time complexity of merge sort
is O(n*logn).
• Average Case Complexity - It occurs when the array elements are in
jumbled order that is not properly ascending and not properly
descending. The average case time complexity of merge sort is O(n*logn).
• Worst Case Complexity - It occurs when the array elements are required
to be sorted in reverse order. That means suppose you have to sort the
array elements in ascending order, but its elements are in descending
order. The worst-case time complexity of merge sort is O(n*logn).
2. Space Complexity
The space complexity of merge sort is O(n). It is because, in merge sort,
an extra variable is required for swapping.
References
WEB LINKS
• https://www.geeksforgeeks.org/data-structures/
• https://www.javatpoint.com/data-structure-tutoria
l
• https://www.tutorialspoint.com/data_structures_al
gorithms/index.htm
VIDEO LINK
• https://www.youtube.com/watch?v=AT14lCXuMKI
&list=PLdo5W4Nhv31bbKJzrsKfMpo_grxuLl8LU
Research Paper
• https://books.google.co.in/books?id=S-tXjl1hsUYC
THANK YOU
For queries
Email: [email protected]
15