Fiveable
Fiveable

Merge Sort

Definition

Merge Sort is an efficient, comparison-based sorting algorithm that divides an unsorted list into smaller sublists, sorts those sublists recursively, and then merges them back together to obtain a sorted list.

Analogy

Think of merge sort as organizing your messy bookshelf. You divide your books into smaller groups, sort each group separately by title (recursively), and then merge these groups back together while keeping them in order to create a neatly organized bookshelf.

Related terms

Quick Sort: A divide-and-conquer sorting algorithm that selects a pivot element and partitions the array around it. It recursively sorts subarrays before and after the pivot.

Heap Sort: A comparison-based sorting algorithm that uses binary heaps to build a partially ordered tree structure which is then used for sorting.

Radix Sort: A non-comparative integer sorting algorithm that distributes data elements into buckets based on digits or significant places.



© 2024 Fiveable Inc. All rights reserved.

AP® and SAT® are trademarks registered by the College Board, which is not affiliated with, and does not endorse this website.


© 2024 Fiveable Inc. All rights reserved.

AP® and SAT® are trademarks registered by the College Board, which is not affiliated with, and does not endorse this website.