Skip to content

feat: add Big-O time & space complexity cheat sheet page - #1027

Closed
ashrion wants to merge 1 commit into
Canopus-Labs:mainfrom
ashrion:feature/complexity-cheat-sheet
Closed

feat: add Big-O time & space complexity cheat sheet page#1027
ashrion wants to merge 1 commit into
Canopus-Labs:mainfrom
ashrion:feature/complexity-cheat-sheet

Conversation

@ashrion

@ashrion ashrion commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

Summary

Adds a Big-O time & space complexity cheat sheet — a single revision page covering data structure operations, sorting algorithms, graph algorithms and complexity classes, so users don't have to re-google the same tables before every interview.

What changed

  • New frontend/src/data/complexityCheats.js:
    • 10 data structures with average + worst-case access/search/insert/delete
    • 9 sorting algorithms (best/average/worst time, space, stability) with notes
    • 9 graph algorithms + 5 common patterns (binary search, two pointers, sliding window, hashmap, memoization)
    • 7 complexity class tiers (O(1) → O(n!)) with plain-language explanations and examples
  • New frontend/src/pages/ComplexityCheats/ComplexityCheats.jsx:
    • tabbed sections (Data Structures / Sorting / Graph & Patterns / Complexity Classes)
    • live filter across names, notes and descriptions
    • sortable sorting table — click Best/Average/Worst/Space column headers to re-sort
    • average/worst-case toggle for data structures
    • color-coded complexity badges (green → red scale) and click-to-expand "why it matters" notes
  • App.jsx route /complexity-cheat-sheet + Sidebar.jsx nav entry under Interview.

Architecture notes

  • Pure data module + presentational page, no dependencies or backend — follows the existing data-driven page pattern.
  • Complexity-to-color mapping and table sorting are isolated helpers so the data stays plain JSON-safe and easy to extend (add an algorithm → it shows up with correct badges automatically).
  • Sort order for the table uses an explicit complexity rank so "O(n)" sorts before "O(n log n)" and "O(n²)".

How to test

  1. cd frontend && npm run dev
  2. Open /complexity-cheat-sheet (Interview > Complexity Cheat Sheet).
  3. Switch tabs, type "heap" in the filter, click the "Worst" column to re-sort, toggle Average/Worst for data structures, expand a row for notes.

Verification

- Add complexityCheats data module: data structure operations, sorting
  algorithms, graph algorithms, patterns and complexity class tiers
- Add ComplexityCheats page with tabs, search, sortable sorting table,
  avg/worst-case toggle, color-coded complexity badges and expandable
  notes
- Register /complexity-cheat-sheet route and Sidebar nav entry
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature]: Big-O Time & Space Complexity Cheat Sheet

2 participants