Learn new algorithms in an interactive and fun way!

Get Started!

How many pointers???


How many pointers do I use here?

Recursion??? Loop???


Does this use recursion or loop?

Whaaat is the time complexity?


O(n), O(n^2), O(log n), what is it?
All your questioned answered at one place!
Searching
Learn about various searching algorithms, how they work and how fast they work!
Learn more
Sorting
Sort elements like a pro with various sorting algorithms!
Learn more
Stack
Explore stack data structure and its operations!
Learn more
Queue
All about queue and its operations!
Learn more
Tree
Learn about the tree data structure and its traversal methods!
Learn more
Dynamic Programming
Master DP with interactive tables, backtracking, and step-by-step visualizations!
Learn more
You can control everything!

The working of each algorithm is interactable!

You can also add your own array and see how it works!

Current values


Number of passes: 1
Current index: 1
4
@ 0
2
@ 1
6
@ 2
3
@ 3
1
@ 4
9
@ 5
Starting from bare bones, to implementing the algorithms yourself!
Insertion Sort
    • 🔄 Insertion Sort is like sorting a hand of playing cards.
    • 🃏 Imagine you have a few cards in your hand, and you pick them one by one.
    • 👀 You look at each new card and find the right spot for it among the cards already in your hand.
    • ➡️ You slide the new card into the correct position, keeping your hand sorted.
    • 🎉 By the end, all the cards in your hand are sorted perfectly!
    • 📚 Insertion Sort does the same thing with an array of numbers.
    • 🔢 It takes one number at a time, compares it with the numbers before it, and inserts it in the right place.
    • 💡 It's a simple and intuitive way to sort, perfect for small datasets and learning the basics of sorting algorithms.

    Stats!


    Time Complexity: O(n^2)
    Space Complexity: O(1)

Steps to solve it yourself!
    • 🔢 Step 1: Start with the First Number
      • 📚 Take the first number in your array. This is the beginning of your sorted section.
    • ➡️ Step 2: Move to the Next Number
      • 🔢 Pick the next number in the array. This number will be inserted into the sorted section.
    • 🔍 Step 3: Find the Correct Spot
      • 👀 Compare this number with the numbers in the sorted section, starting from the end.
    • 🔄 Step 4: Shift Larger Numbers
      • 🔄 If the number is smaller than the one in the sorted section, move the larger number one position to the right.
    • ⬆️ Step 5: Continue Comparing
      • ⬆️ Keep moving left and comparing the number with the sorted section until you find the right spot for it.
    • ⬇️ Step 6: Insert the Number
      • ⬇️ Insert the number into its correct position in the sorted section.
    • ➡️ Step 7: Repeat the Process
      • ➡️ Move to the next number in the array and repeat steps 3 to 6.
    • 🔄 Step 8: Continue Until Sorted
      • 🔄 Continue this process until you've moved through the entire array.
    • 🎉 Step 9: Celebrate Your Success
      • 🎉 Congratulations! Your array is now sorted using insertion sort!

We also provide code which is ready to be used!
Code

Loading...
So what are you waiting for?

Get Started for free!

Algodoodle