liveBook · Manning

Merge sort

Also called MergeSort

Merge sort is a comparison-based sorting algorithm that recursively divides a sequence and merges the resulting sorted subsequences.

How 3 Manning books explain it

Type-Driven Development with Idris

Merge sort is a sorting algorithm that recursively divides a list into smaller parts and merges the sorted parts.

How it is used
Uses merge sort to demonstrate list views and recursive traversals in Idris.
How deep it goes
Develops a split view and covering function, then refines the sorting implementation to pass the totality checker.
Examples
Merges two sorted integer lists, sorts sample lists, and checks mergeSort with the REPL totality command.
What you can do after
Build it from scratch in Idris using a recursive list view and check its totality.

Read how Type-Driven Development with Idris explains merge sort →

Clojure: The Essential Reference

Merge sort is a comparison-sorting algorithm that recursively divides input into smaller portions and merges ordered portions back together.

How it is used
Handles large datasets by sorting bounded chunks externally and presenting their results as a lazy sequence.
How deep it goes
Explains chunk splitting, parallel processing, disk storage, and lazy merging, stopping short of lower-level algorithm analysis.
Examples
Uses IdRange, temporary files, parallel chunk processing, and a psort call returning the first ten values.
What you can do after
Build it from scratch with reducers, temporary files, chunk sorting, and a lazy multiway merge.

Read how Clojure: The Essential Reference explains merge sort →

100 Go Mistakes and How to Avoid Them

A comparison-sorting algorithm that recursively divides a collection and merges sorted subcollections.

How it is used
Uses merge sort to demonstrate why concurrency is not always faster.
How deep it goes
Explains recursive splitting, merging, goroutine coordination, benchmarking, and a workload-size cutoff.
Examples
Uses sequential and parallel Go implementations, benchmark results, and a 2,048-element cutoff.
What you can do after
Evaluate when parallelizing recursive work helps and apply a cutoff to reduce concurrency overhead.

Read how 100 Go Mistakes and How to Avoid Them explains merge sort →

Related concepts

Questions about merge sort

What is merge sort?

Merge sort is a comparison-based sorting algorithm that recursively divides a sequence and merges the resulting sorted subsequences.

Which Manning books explain merge sort?

Type-Driven Development with Idris, Clojure: The Essential Reference and 100 Go Mistakes and How to Avoid Them.

What is the difference between merge sort and quicksort?

Merge sort is a comparison-based sorting algorithm that recursively divides a sequence and merges the resulting sorted subsequences. Quicksort is a comparison-based sorting algorithm that partitions elements around a pivot and recursively sorts the resulting partitions.

What kinds of merge sort are there?

Kinds of merge sort include parallel merge sort.

What is merge sort a kind of?

Merge sort is a kind of sorting algorithm. A sorting algorithm is a procedure that rearranges elements of a collection into an order determined by an ordering criterion.

What is merge sort also called?

Merge sort is also called MergeSort.

These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.