MCA
DATA STRUCTURES & ALGORITHMS // BIG-O NOTATION // TIME COMPLEXITY // SPACE COMPLEXITY // DATA STRUCTURES & ALGORITHMS // BIG-O NOTATION // TIME COMPLEXITY // SPACE COMPLEXITY //
BACK TO HOME
O(N) O(1)

ALGORITHMS
&_DATA_

THE INTERVIEW Gauntlet

MODULES
12
EASY
4
MEDIUM
5
HARD
3

STRUCTURES_

[]
easy

Arrays & Strings

Basic data structures and string manipulation

->
easy

Linked Lists

Singly, doubly, and circular traversing nodes

||
easy

Stacks & Queues

LIFO and FIFO data structures in memory

medium

Recursion

Function calls and backtracking trees

🌲
medium

Trees & BST

Root traversals and balanced structures

#
medium

Hashing

Table configurations and collision handlers

hard

Graphs

BFS, DFS mappings and shortest paths

grid
hard

Dynamic Prog

Memoization matrices and tabulation limits

max
medium

Greedy algos

Greedy logic optimization strategies

sort
easy

Sorting & Search

Big-O linear vs iterative comparisons

heap
medium

Heaps & PQ

Min-Max heaps and prioritized queues

trie
hard

Advanced D.S.

Tries, Segments, Fenwick and Maps

PATTERNS

Two Pointers

Optimize array traversals

Sliding Window

Find subset lengths in linear time O(N)

Fast & Slow Pointers

Detect cycles in linked lists

Merge Intervals

Overlapping time constraints

Topological Sort

Dependency mapping in directed acyclic graphs

TIME_COMPLEXITY

O(1)Constant ~ Hash Maps
O(log N)Logarithmic ~ Binary Search
O(N)Linear ~ Simple loops
O(N log N)Quasilinear ~ Merge Sort
O(N²)Quadratic ~ Nested loops
O(2^N)Exponential ~ Recursive trees

SYNTAX_DEMO

binary_search.js
// ============================================
// BINARY SEARCH O(log N)
// ============================================

/**
 * Searches for target in sorted array
 * @param {number[]} nums
 * @param {number} target
 * @return {number} index
 */
var search = function(nums, target) {
    let left = 0;
    let right = nums.length - 1;
    
    while (left <= right) {
        // Prevent integer overflow bugs
        let mid = Math.floor(left + (right - left) / 2);
        
        if (nums[mid] === target) {
            return mid; // Target found 🎉
        } else if (nums[mid] < target) {
            left = mid + 1; // Dig into right half
        } else {
            right = mid - 1; // Dig into left half
        }
    }
    
    return -1; // Target does not exist 🤔
};

// Test
const arr = [-1, 0, 3, 5, 9, 12];
console.log(search(arr, 9)); // expected output: 4

DIRECTORY