From 856ac32b0ac97f544c87802a1df31bc06171b600 Mon Sep 17 00:00:00 2001 From: Roshan330 Date: Mon, 17 Aug 2026 22:50:58 +0530 Subject: [PATCH] docs: add insertion sort explanation --- .../content/insertion-sort@liJfTV5ajAFZcfwBdVGpU.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/roadmaps/datastructures-and-algorithms/content/insertion-sort@liJfTV5ajAFZcfwBdVGpU.md b/roadmaps/datastructures-and-algorithms/content/insertion-sort@liJfTV5ajAFZcfwBdVGpU.md index 70ad9d4a3388..b36e45dcb7ee 100644 --- a/roadmaps/datastructures-and-algorithms/content/insertion-sort@liJfTV5ajAFZcfwBdVGpU.md +++ b/roadmaps/datastructures-and-algorithms/content/insertion-sort@liJfTV5ajAFZcfwBdVGpU.md @@ -1,5 +1,12 @@ # Insertion Sort +Insertion sort is a simple sorting algorithm that works by iteratively inserting each element of an unsorted list into its correct position in a sorted portion of the list. It is like sorting playing cards in your hands. You split the cards into two groups: the sorted cards and the unsorted cards. Then, you pick a card from the unsorted group and put it in the right place in the sorted group. + +- Start with the second element as the first element is assumed to be sorted. +- Compare the second element with the first if the second is smaller then swap them. +- Move to the third element, compare it with the first two, and put it in its correct position +- Repeat until the entire array is sorted. + Visit the following resources to learn more: - [@course@Insertion Sort](https://youtu.be/JU767SDMDvA)