Vibe Check: Algorithms

DSA without the
emotional damage.

Learn how searching and sorting algorithms actually work under the hood. No boring lectures, just pure logic, flowcharts, and visuals.

The Vibe ✨The absolute basics you need to survive.

Python Starter Pack

Before we jump into the algorithms, here is a 60-second crash course on the Python syntax you're going to see.

Lists (Arrays) πŸ“š

Basically a numbered bookshelf. Items start at position (index) `0`. If you want the first item, you ask for `[0]`.

Loops πŸ”

Doing the same thing over and over. Use `for` when you know how many times to repeat. Use `while` to repeat until a condition is met.

Part 1: Searching

How do you find a specific item in a massive list? It depends on if the list is organized or completely chaotic.

Part 2: Sorting

Turning chaos into order. Every algorithm here does the exact same job, but they have totally different "personalities" on how they achieve it.

The Vibe ✨ The "Pick Me" Algorithm

Selection Sort

This algorithm scans the whole crowd, points at the absolute smallest number, and says "You. Go to the front." Then it ignores the first spot, scans the rest, finds the next smallest, and puts it second. Very methodical, kinda slow.

πŸ—ΊοΈ View Flowchart
Start Outer Loop (i = 0 to n)
Assume min_index = i
Scan unsorted part (Inner Loop j)
Found smaller item?
YES
Update min_index
Swap arr[i] with arr[min_index]
Repeat for next i

🧠 The Brain Map: How to code this

  • Outer Loop: A for loop (i) representing where the next smallest number should go.
  • Inner Loop: Assume i is the minimum. Use a second loop (j) starting from i+1 to scan the rest.
  • The Swap: If we find something smaller, update min_idx. After the inner loop, swap them.
The Vibe ✨ The "Vibes Based" Sort

Bubble Sort

Literally just compares the person next to them. "Are you taller than me? Let's swap." By doing this repeatedly, the biggest numbers naturally "bubble" up to the very end of the list, like boba in a milk tea.

πŸ—ΊοΈ View Flowchart
Start Pass (Outer Loop i)
Check adjacent items (Inner Loop j)
Is arr[j] > arr[j+1]?
YES
Swap them
NO
Do nothing
Biggest item bubbles to the end
Repeat until fully sorted

🧠 The Brain Map: How to code this

  • The Pass: We need to pass through the list multiple times. (Outer for loop).
  • The Check: Compare adjacent elements: arr[j] > arr[j+1]. If they are out of order, swap them!
  • The Optimization: The inner loop goes to n - i - 1. Why? Because after every pass, the biggest element is safely at the end.
The Vibe ✨ Main Character Syndrome

Quick Sort

Pick one random number (the pivot). Make everyone smaller stand to the left, and everyone bigger stand to the right. The pivot is now exactly where it belongs forever. Recursively do this for the left and right squads. Very fast. Very bossy.

πŸ—ΊοΈ View Flowchart
Pick a Pivot (usually last element)
Partition the Array
< Pivot
(Left Squad)
Pivot locked
in place
> Pivot
(Right Squad)
Call QuickSort on Left & Right

🧠 The Brain Map: How to code this

  • The Partition: Pick the last item as the pivot. Use pointer i to track where the "smaller than pivot" section ends.
  • The Scan: As we loop (j), if a number is smaller than the pivot, swap it to the left side (index i+1).
  • The Recursion: Once the pivot is locked in place, the function calls itself to sort the left and right sides.

Knowledge Check 🧠

Did you actually understand the algorithms, or were you just staring at the moving blocks? Let's find out.

About the Creator

Amandeep Singh Khanna

Amandeep Singh Khanna

Sr. Data Scientist

This website was built to make learning Data Structures and Algorithms visual, intuitive, and stress-free. By bridging the gap between abstract computer science concepts and relatable everyday analogies, the goal is to make these fundamental topics accessible to all my students.

View Portfolio