# Cheatsheet for all > Fast, searchable Data Structures & Algorithms (DSA) cheatsheets for competitive programming and LeetCode, across Rust, C++, Lua, Python, and Java. Copyable code snippets grouped by topic. Full plain-text content: https://cheatsheet-for-o0oy0ggvt-piyushxcoders-projects.vercel.app/llms-full.txt ## C++ - [Syntax Basics](https://cheatsheet-for-o0oy0ggvt-piyushxcoders-projects.vercel.app/?lang=cpp&page=cpp-basics): The C++ skeleton, types, and I/O you need for DSA. - [vector](https://cheatsheet-for-o0oy0ggvt-piyushxcoders-projects.vercel.app/?lang=cpp&page=cpp-vector): Dynamic array — the workhorse of DSA in C++. - [string](https://cheatsheet-for-o0oy0ggvt-piyushxcoders-projects.vercel.app/?lang=cpp&page=cpp-string): std::string operations for parsing and text problems. - [map & unordered_map](https://cheatsheet-for-o0oy0ggvt-piyushxcoders-projects.vercel.app/?lang=cpp&page=cpp-map): Key-value stores: ordered (tree) vs hashed. - [set & unordered_set](https://cheatsheet-for-o0oy0ggvt-piyushxcoders-projects.vercel.app/?lang=cpp&page=cpp-set): Unique collections: ordered (tree) vs hashed. - [stack, queue, deque & heap](https://cheatsheet-for-o0oy0ggvt-piyushxcoders-projects.vercel.app/?lang=cpp&page=cpp-stack-queue): Adapters for LIFO, FIFO, double-ended, and priority order. - [ & iterators](https://cheatsheet-for-o0oy0ggvt-piyushxcoders-projects.vercel.app/?lang=cpp&page=cpp-algorithms): The STL algorithms that replace hand-written loops. - [Sorting & Searching](https://cheatsheet-for-o0oy0ggvt-piyushxcoders-projects.vercel.app/?lang=cpp&page=cpp-sorting): sort, custom comparators, and binary search on sorted data. - [DSA Patterns](https://cheatsheet-for-o0oy0ggvt-piyushxcoders-projects.vercel.app/?lang=cpp&page=cpp-patterns): Reusable templates for the classic interview patterns. - [Graphs & Trees](https://cheatsheet-for-o0oy0ggvt-piyushxcoders-projects.vercel.app/?lang=cpp&page=cpp-graphs): Adjacency lists, traversals, shortest paths. - [Numbers, Math & Bits](https://cheatsheet-for-o0oy0ggvt-piyushxcoders-projects.vercel.app/?lang=cpp&page=cpp-numbers): Overflow safety, math helpers, and bit tricks. - [Competitive I/O](https://cheatsheet-for-o0oy0ggvt-piyushxcoders-projects.vercel.app/?lang=cpp&page=cpp-io): Fast input/output patterns for judges. ## Java - [Syntax Basics](https://cheatsheet-for-o0oy0ggvt-piyushxcoders-projects.vercel.app/?lang=java&page=java-basics): Class skeleton, types, control flow and lambdas. - [ArrayList](https://cheatsheet-for-o0oy0ggvt-piyushxcoders-projects.vercel.app/?lang=java&page=java-list): Dynamic array — the workhorse list for DSA in Java. - [String & StringBuilder](https://cheatsheet-for-o0oy0ggvt-piyushxcoders-projects.vercel.app/?lang=java&page=java-string): Immutable strings and the mutable StringBuilder. - [HashMap & TreeMap](https://cheatsheet-for-o0oy0ggvt-piyushxcoders-projects.vercel.app/?lang=java&page=java-map): Hash and sorted key-value maps for counting and lookup. - [HashSet & TreeSet](https://cheatsheet-for-o0oy0ggvt-piyushxcoders-projects.vercel.app/?lang=java&page=java-set): Unique-element sets, hashed or sorted. - [Deque, Stack, Queue & PriorityQueue](https://cheatsheet-for-o0oy0ggvt-piyushxcoders-projects.vercel.app/?lang=java&page=java-deque-heap): ArrayDeque for stack/queue/deque, PriorityQueue for heaps. - [Streams & Iterators](https://cheatsheet-for-o0oy0ggvt-piyushxcoders-projects.vercel.app/?lang=java&page=java-streams): Functional pipelines over collections and ranges. - [Sorting & Searching](https://cheatsheet-for-o0oy0ggvt-piyushxcoders-projects.vercel.app/?lang=java&page=java-sorting): Sort arrays and lists, build comparators, binary search. - [DSA Patterns](https://cheatsheet-for-o0oy0ggvt-piyushxcoders-projects.vercel.app/?lang=java&page=java-patterns): Reusable templates for the classic interview patterns. - [Graphs & Trees](https://cheatsheet-for-o0oy0ggvt-piyushxcoders-projects.vercel.app/?lang=java&page=java-graphs): Adjacency lists, BFS/DFS, Dijkstra, topo sort and trees. - [Numbers, Math & Bits](https://cheatsheet-for-o0oy0ggvt-piyushxcoders-projects.vercel.app/?lang=java&page=java-numbers): Overflow-safe arithmetic, Math helpers and bit tricks. - [Competitive I/O](https://cheatsheet-for-o0oy0ggvt-piyushxcoders-projects.vercel.app/?lang=java&page=java-io): Fast reading and buffered output for contests. ## Lua - [Syntax Basics](https://cheatsheet-for-o0oy0ggvt-piyushxcoders-projects.vercel.app/?lang=lua&page=lua-basics): Lua fundamentals (5.3+) — note: tables are 1-indexed! - [Tables as Arrays](https://cheatsheet-for-o0oy0ggvt-piyushxcoders-projects.vercel.app/?lang=lua&page=lua-array): Sequences (1-indexed tables) — Lua's list workhorse. - [Strings](https://cheatsheet-for-o0oy0ggvt-piyushxcoders-projects.vercel.app/?lang=lua&page=lua-string): Immutable strings + the powerful string library. - [Tables as Maps & Sets](https://cheatsheet-for-o0oy0ggvt-piyushxcoders-projects.vercel.app/?lang=lua&page=lua-map): The same table doubles as hash map and set. - [Stack, Queue & Deque](https://cheatsheet-for-o0oy0ggvt-piyushxcoders-projects.vercel.app/?lang=lua&page=lua-stack-queue): Built from plain tables — Lua has no dedicated types. - [Iteration & Higher-Order](https://cheatsheet-for-o0oy0ggvt-piyushxcoders-projects.vercel.app/?lang=lua&page=lua-iteration): pairs/ipairs and hand-rolled map/filter/reduce. - [Sorting & Searching](https://cheatsheet-for-o0oy0ggvt-piyushxcoders-projects.vercel.app/?lang=lua&page=lua-sorting): table.sort with comparators + binary search. - [DSA Patterns](https://cheatsheet-for-o0oy0ggvt-piyushxcoders-projects.vercel.app/?lang=lua&page=lua-patterns): Classic templates in Lua, including a binary heap. - [Graphs & Trees](https://cheatsheet-for-o0oy0ggvt-piyushxcoders-projects.vercel.app/?lang=lua&page=lua-graphs): Adjacency lists and traversals with tables. - [Numbers, Math & Bits](https://cheatsheet-for-o0oy0ggvt-piyushxcoders-projects.vercel.app/?lang=lua&page=lua-numbers): math library, integer/float rules, and bit ops (5.3+). - [Competitive I/O](https://cheatsheet-for-o0oy0ggvt-piyushxcoders-projects.vercel.app/?lang=lua&page=lua-io): Fast stdin/stdout patterns for judges. ## Python - [Syntax Basics](https://cheatsheet-for-o0oy0ggvt-piyushxcoders-projects.vercel.app/?lang=python&page=py-basics): Core Python 3 syntax: variables, control flow, functions. - [Lists](https://cheatsheet-for-o0oy0ggvt-piyushxcoders-projects.vercel.app/?lang=python&page=py-list): Dynamic array — the workhorse of DSA in Python. - [Strings](https://cheatsheet-for-o0oy0ggvt-piyushxcoders-projects.vercel.app/?lang=python&page=py-string): Immutable text — slicing, methods, and char math. - [dict](https://cheatsheet-for-o0oy0ggvt-piyushxcoders-projects.vercel.app/?lang=python&page=py-dict): Hash map — O(1) lookup, insertion-ordered since 3.7. - [set](https://cheatsheet-for-o0oy0ggvt-piyushxcoders-projects.vercel.app/?lang=python&page=py-set): Hash set — O(1) membership and set algebra. - [deque, heapq & Counter](https://cheatsheet-for-o0oy0ggvt-piyushxcoders-projects.vercel.app/?lang=python&page=py-collections): Queues, priority queues, and specialized containers. - [Comprehensions & Iterators](https://cheatsheet-for-o0oy0ggvt-piyushxcoders-projects.vercel.app/?lang=python&page=py-comprehensions): Comprehensions, generators, and the itertools toolkit. - [Sorting & Searching](https://cheatsheet-for-o0oy0ggvt-piyushxcoders-projects.vercel.app/?lang=python&page=py-sorting): Sort keys, custom comparators, and binary search (bisect). - [DSA Patterns](https://cheatsheet-for-o0oy0ggvt-piyushxcoders-projects.vercel.app/?lang=python&page=py-patterns): Reusable templates for the classic interview patterns. - [Graphs & Trees](https://cheatsheet-for-o0oy0ggvt-piyushxcoders-projects.vercel.app/?lang=python&page=py-graphs): Adjacency lists, BFS/DFS, Dijkstra, topo sort, tree traversal. - [Numbers, Math & Bits](https://cheatsheet-for-o0oy0ggvt-piyushxcoders-projects.vercel.app/?lang=python&page=py-numbers): Arbitrary-precision ints, math module, and bit tricks. - [Competitive I/O](https://cheatsheet-for-o0oy0ggvt-piyushxcoders-projects.vercel.app/?lang=python&page=py-io): Fast reading, parsing, and formatted output for judges. ## Rust - [Syntax Basics](https://cheatsheet-for-o0oy0ggvt-piyushxcoders-projects.vercel.app/?lang=rust&page=syntax): Bindings, control flow, functions, structs, enums, closures. - [Vec](https://cheatsheet-for-o0oy0ggvt-piyushxcoders-projects.vercel.app/?lang=rust&page=vec): Growable array — the workhorse of DSA in Rust. - [String & &str](https://cheatsheet-for-o0oy0ggvt-piyushxcoders-projects.vercel.app/?lang=rust&page=string): Owned String vs borrowed &str, chars, bytes, parsing. - [HashMap & HashSet](https://cheatsheet-for-o0oy0ggvt-piyushxcoders-projects.vercel.app/?lang=rust&page=hashmap): O(1) average lookup. Frequency counts, seen-sets, memoization. - [BTreeMap & BTreeSet](https://cheatsheet-for-o0oy0ggvt-piyushxcoders-projects.vercel.app/?lang=rust&page=btree): Sorted map/set. Ordered iteration + range queries in O(log n). - [VecDeque & BinaryHeap](https://cheatsheet-for-o0oy0ggvt-piyushxcoders-projects.vercel.app/?lang=rust&page=deque-heap): Queue/deque for BFS, priority queue for Dijkstra/greedy. - [Iterators](https://cheatsheet-for-o0oy0ggvt-piyushxcoders-projects.vercel.app/?lang=rust&page=iterators): Lazy, chainable, zero-cost. The Rust way to transform data. - [Sorting & Searching](https://cheatsheet-for-o0oy0ggvt-piyushxcoders-projects.vercel.app/?lang=rust&page=sorting): Sort by keys, custom comparators, binary search on slices. - [DSA Patterns](https://cheatsheet-for-o0oy0ggvt-piyushxcoders-projects.vercel.app/?lang=rust&page=patterns): Ready-to-adapt templates for the classic techniques. - [Graphs & Trees](https://cheatsheet-for-o0oy0ggvt-piyushxcoders-projects.vercel.app/?lang=rust&page=graph): Adjacency lists, BFS/DFS, and recursion on grids/trees. - [Numbers & Math](https://cheatsheet-for-o0oy0ggvt-piyushxcoders-projects.vercel.app/?lang=rust&page=numbers): Int types, overflow, casts, gcd, bit tricks, common constants. - [Ownership & Borrowing](https://cheatsheet-for-o0oy0ggvt-piyushxcoders-projects.vercel.app/?lang=rust&page=ownership): The borrow checker rules that trip up DSA code, and the fixes. - [Competitive I/O](https://cheatsheet-for-o0oy0ggvt-piyushxcoders-projects.vercel.app/?lang=rust&page=io): Fast stdin/stdout reading for Codeforces / competitive judges.