Jan 26 · 4 min read · Insertion sort is one of those algorithms that looks simple but feels confusing when you first come across it. As a beginner, I struggled to understand how it actually works. This article walks through insertion sort step-by-step, making sure you don...
Join discussionNov 29, 2025 · 6 min read · Insertion sort is a simple comparison-based sorting algorithm that sorts by repeatedly inserting elements into their correct position. Let's explore how it works in detail. What is Insertion Sort? Insertion Sort is a comparison sort algorithm. It div...
Join discussion
Jun 18, 2025 · 2 min read · 🫧 1. Bubble Sort Compare adjacent pairs of elements in an array and swap them if they are in the wrong order, gradually moving larger elements to the end of the array. 1.1. Time Complexity Average / Worst case: O(n^2) Best case: O(n) (already so...
Join discussion
Jun 12, 2025 · 2 min read · 📌 What is Insertion Sort? Insertion Sort is a simple, intuitive sorting algorithm that works similarly to how you might sort playing cards in your hands: You start with the second element, compare it with the one before it, and insert it in the rig...
Join discussionMay 12, 2025 · 4 min read · Selection Sort Selection sort is the simplest way to sort an array. Pretend that index 0 is the smallest, and we look at each element. We select the smallest element from other index and swap the two elements. array = [5, 7, 9, 0, 3, 1, 6, 2, 4, 8] ...
Join discussion
Mar 9, 2025 · 38 min read · Sorting means arranging a given array or list of elements based on a comparison operator. This operator helps determine the new order of the elements in the data structure. For example, you may need to sort the array in descending or ascending order,...
Join discussion
Jan 31, 2025 · 3 min read · Imagine que você está empilhando livros em ordem de tamanho, do maior para o menor. Cada vez que pega um livro, você compara com os outros na pilha e o coloca no lugar certo, reorganizando se precisar, até que a pilha inteira esteja na ordem correta....
Join discussionDec 31, 2024 · 3 min read · When analyzing algorithms, the concept of space complexity often accompanies its counterpart, time complexity. However, the term is frequently misused or conflated with auxiliary space. This article clarifies the differences, highlights their signi...
Join discussion
Dec 28, 2024 · 4 min read · Example: We have an unsorted array:[64, 25, 12, 22, 11] The goal is to sort this array in ascending order using Insertion Sort, which works by iteratively building a sorted portion of the array. Step-by-Step Execution: Initial Array: [64, 25, 12, 22...
Join discussion