AI engineering glossary · Data structures algorithms

What is insertion sort?

Insertion sort: A sorting method that builds a sorted section one item at a time, inserting each new item into its correct place among the already sorted ones. It takes O(n^2) in general but is fast on nearly sorted data and small inputs.

Level: beginnerTopic: Data structures algorithms

Insertion sort: an example

Sorting playing cards in your hand by picking up one card at a time and sliding it into the right spot is insertion sort.

Related terms

More Data structures algorithms terms

Where you learn it

Insertion sort is part of the AI Engineering Program, which teaches it with notes, a hands-on lab and an exam. The first lesson is free.

Before you go

Take the cheat sheet with you

One free PDF: the key AI-engineering terms, formulas and Python idioms. No spam; unsubscribe any time.