8.1.6

Insertion Sort

Test yourself

Insertion Sort

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

Illustrative background for The conceptIllustrative background for The concept ?? "content

The concept

  • Imagine sorting a deck of cards.
  • Hold the deck of cards in one hand, and place a single card down on the desk.
  • Take a card from the top of the deck in your hand, and put it in the correct place in the other deck.
  • Repeat until all the cards are gone.
Illustrative background for In EnglishIllustrative background for In English ?? "content

In English

  • Take the second card:
    • Compare to the first card, swap if needed.
  • Take the third card:
    • Compare to second card, swap if needed.
    • Compare to first card, swap if needed.
  • Take the fourth card:
    • Compare to all previous cards.
  • Repeat for all cards.
Illustrative background for Pros and cons of insertion sortIllustrative background for Pros and cons of insertion sort ?? "content

Pros and cons of insertion sort

  • Pros:
    • Easy to implement.
    • Little memory used.
  • Cons:
    • Not very efficient.

Jump to other topics

1Components of a Computer

2Software & Software Development

3Exchanging Data

4Data Types, Data Structures & Algorithms

5Legal, Moral, Cultural & Ethical Issues

6Elements of Computational Thinking

6.1Thinking Abstractly

6.2Thinking Ahead

6.3Thinking Procedurally

6.4Thinking Logically

6.5Thinking Concurrently

7Problem Solving & Programming

8Algorithms

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