2.1.14

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 insert it in the right 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

1Computer Systems

1.1Systems Architecture

1.2Memory & Storage

1.3Computer Networks, Connections & Protocols

1.4Network Security

1.5Systems Software

1.6Ethical, Legal, Cultural & Environmental Concern

2Computational Thinking, Algorithms and Programming

2.1Algorithms

2.2Programming Fundamentals

2.3Producing Robust Programs

2.4Boolean Logic

2.5Programming Languages & IDEs

Go student ad image

Unlock your full potential with GoStudent tutoring

  • Affordable 1:1 tutoring from the comfort of your home

  • Tutors are matched to your specific learning needs

  • 30+ school subjects covered

Book a free trial lesson