#merge-sort
Balanced K Way Merge Sort
Balanced K Way Merge Sort Balanced k way merge sort is an external sorting algorithm that repeatedly merges sorted runs in groups of at most $k$. Unlike polyphase merge sort, it tries to keep the merge work evenly distributed across passes. It is a simple and common model for large file sorting. The input is first divided into memory-sized chunks, each chunk is sorted internally, and then the resulting sorted...
GPU Merge Sort
GPU Merge Sort GPU merge sort adapts merge sort to GPU execution by replacing recursive merging with parallel merge kernels. The algorithm operates in passes, merging sorted runs of increasing size. Unlike GPU radix sort, this method works for arbitrary comparable keys. Its performance depends on efficient parallel merge and memory throughput. Problem Given an array $A$ of size $n$ stored on a GPU, sort it in nondecreasing order. Algorithm...
Parallel Merge Sort
Parallel Merge Sort Parallel merge sort extends merge sort by executing recursive subproblems concurrently. The structure remains divide and conquer, but the recursion tree becomes a parallel computation graph. You split the array into halves, sort each half in parallel, then merge the results. The merge step can also be parallelized using partitioning techniques. Problem Given an array $A$ of size $n$, produce a sorted array in nondecreasing order using...
Polyphase Merge Sort
Polyphase Merge Sort Polyphase merge sort is an external sorting algorithm for merging many sorted runs using a limited number of files or tapes. It avoids the rigid redistribution step used by balanced merge sort. Instead, it places different numbers of runs on different input files so each merge phase naturally prepares the next phase. This method was especially important for tape drives, where rewinding and redistribution were expensive. The...
External Merge Sort
External Merge Sort External merge sort is a disk-based sorting algorithm designed for datasets that exceed main memory. It minimizes random I/O and relies on sequential reads and writes, which are efficient on disks and object storage. You use it when the input size is much larger than RAM, for example multi-gigabyte or terabyte scale data. Model Assume: Input size: $N$ elements Memory capacity: $M$ elements Block size: $B$ elements...
Tape Merge Sort
Tape Merge Sort Tape merge sort is an external sorting algorithm designed for sequential storage. It was historically used with magnetic tapes, where random access was expensive or unavailable. The algorithm writes sorted runs to multiple tapes, then repeatedly merges runs from input tapes onto output tapes. The same idea still matters for sequential external storage: make long sequential reads and writes, avoid random seeks, and reduce the number of...
Cascade Merge Sort
Cascade Merge Sort Cascade merge sort is an external sorting method that organizes merging into a pipeline of stages. Each stage merges a group of sorted runs and passes the resulting larger runs to the next stage. The purpose is to reduce repeated redistribution and make external merging easier to schedule. It is most useful when runs arrive gradually or when storage bandwidth can be used by several merge stages...