Subroutine Logo
Subroutine
Weekly Interactive Computer Science Blog

Master Programming Concepts
Through Sound & Visual Intuition

An open educational playground covering algorithms, low-level systems optimization, C++, neural networks, and computer architecture.

Featured Playground

Live Web Audio API & HTML5 Canvas Simulation

Read Full Article →

Quick Sort

Avg: O(N log N)Space: O(log N)

Picks a pivot element and partitions the surrounding array into elements smaller and larger than the pivot recursively.

Size:32
Speed:40ms
Compares: 0
Swaps: 0
Implementation Code for Quick Sort
quick_sort.cpp
C++
template <typename T>
int partition(std::vector<T>& arr, int low, int high) {
    T pivot = arr[high];
    int i = low - 1;
    for (int j = low; j < high; j++) {
        if (arr[j] < pivot) {
            i++;
            std::swap(arr[i], arr[j]);
        }
    }
    std::swap(arr[i + 1], arr[high]);
    return i + 1;
}

template <typename T>
void quickSort(std::vector<T>& arr, int low, int high) {
    if (low < high) {
        int p = partition(arr, low, high);
        quickSort(arr, low, p - 1);
        quickSort(arr, p + 1, high);
    }
}

Educational Articles

Written in MDX with embedded interactive widgets

15 Topic(s) Available
Languages Intermediate

Virtual Machine Bytecode Execution Engines

An interactive programming languages exploration of CPython and JVM stack machines, instruction pointers, and bytecode dispatch loops.

2026-07-26 Read Article →
AI & ML Intermediate

CNN 2D Image Filters & Convolution Feature Maps

An interactive computer vision exploration of sliding 2D kernel matrices, Sobel edge detectors, and convolutional feature map generation.

2026-07-26 Read Article →
Languages Intermediate

Concurrency Models: GIL-Free Python, Go Channels, & C++ Threads

How modern programming languages achieve true parallel CPU execution, featuring Python 3.13+ free-threaded builds (PEP 703).

2026-07-26 Read Article →
Systems Advanced

C++ Memory Locality & CPU Cache Line Alignment

Why memory access patterns dictate performance far more than raw instruction counts in high-frequency C++ code.

2026-07-26 Read Article →
Algorithms Intermediate

Dijkstra's & A* Pathfinding: Heuristics & Graph Traversal

An interactive exploration of graph search algorithms, comparing Dijkstra's uniform cost search against A* heuristic estimation.

2026-07-26 Read Article →
Algorithms Intermediate

Dynamic Programming: The 0/1 Knapsack Problem

Understand sub-problem optimization, memoization matrices, and pseudo-polynomial time complexity.

2026-07-26 Read Article →
Physics & Math Intermediate

Interactive Fast Fourier Transform (FFT) & Signal Processing

An interactive mathematical exploration of 1D signal frequency decomposition, Cooley-Tukey O(N log N) FFT, and spectrum analysis.

2026-07-26 Read Article →
Languages Intermediate

Garbage Collection: Mark-and-Sweep & Heap Compaction

How modern language runtimes manage dynamic heap memory, trace root pointer graphs, and reclaim unreferenced object memory.

2026-07-26 Read Article →
AI & ML Intermediate

K-Means Clustering & Voronoi Space Partitioning

An interactive exploration of unsupervised machine learning, Expectation-Maximization (EM) iterations, and cluster boundary optimization.

2026-07-26 Read Article →
Systems Intermediate

Kernel Bypass & Zero-Copy Networking (io_uring & DPDK)

An interactive systems exploration of Linux OS socket syscall overhead, user-space kernel bypass, and io_uring ring buffer architectures.

2026-07-26 Read Article →
AI & ML Beginner

Visualizing Perceptrons & Decision Boundaries

Understand the fundamental building block of artificial neural networks through interactive 2D decision boundary classification.

2026-07-26 Read Article →
Physics & Math Intermediate

Qubits, Superposition & The Bloch Sphere

An interactive quantum physics exploration of quantum bits, Hadamard gates, superposition states, and probabilistic wave function collapse.

2026-07-26 Read Article →
Algorithms Beginner

Visualizing & Hearing Sorting Algorithms

An interactive exploration of fundamental sorting algorithms enhanced with real-time Web Audio sound synthesis and live code inspection.

2026-07-26 Read Article →
Physics & Math Intermediate

Numerical Integration: Verlet vs. Euler Physics Simulation

An interactive physics exploration comparing explicit Euler numerical integration against energy-conserving Verlet position integration.

2026-07-26 Read Article →
Systems Intermediate

Virtual Memory & Page Table Translation

An interactive computer systems exploration of MMU hardware, Translation Lookaside Buffer (TLB) hits, and multi-level page table walks.

2026-07-26 Read Article →