From 866f2f2226e325dbdf29384a3d2e73cb094b4d3a Mon Sep 17 00:00:00 2001 From: Roshan Malviya Date: Tue, 18 Aug 2026 13:11:34 +0530 Subject: [PATCH] docs: add insertion sort explanation (#10239) --- .../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 70ad9d4a3..b36e45dcb 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)