Test your knowledge with free interactive questions on Seneca — used by over 10 million students.

Insertion Sort

Insertion sort is a simple sorting algorithm, which is very intuitive.

The concept

The concept

  • Imagine sorting a deck of cards.
  • You'll keep all the sorted cards at the top of the deck, take the next unsorted card and compare it with all the sorted ones from the front until you find the correct place to insert it.
In English

In English

  • Always assume the first card is sorted, since there are no other values to compare it to.
  • Take the second card and compare it to the one on top. Swap if needed.
  • Take the third card. Compare it with the one on top, then with the second one. Insert it in the correct place.
  • Take the fourth card. Compare it with the one on top, then with the second one, then with the third one. Insert it in the correct place.
  • Repeat until you have sorted all cards.
Jump to other topics
1

Computer Systems

1.1

Systems Architecture

1.2

Memory & Storage

1.3

Computer Networks, Connections & Protocols

1.4

Network Security

1.5

Systems Software

1.6

Ethical, Legal, Cultural & Environmental Concern

2

Computational Thinking, Algorithms & Programming

2.1

Algorithms

2.2

Programming Fundamentals

2.3

Producing Robust Programs

2.4

Boolean Logic

2.5

Programming Languages & IDEs

Unlock your full potential with Seneca Premium

  • Unlimited access to 10,000+ open-ended exam questions

  • Mini-mock exams based on your study history

  • Unlock 800+ premium courses & e-books

Get started with Seneca Premium