Flashcards · Algorithms · Free
Algorithms flashcards, generated for you.
Example Algorithms study cards to learn from right now — then generate a full set from your own notes (plus a practice quiz) and export to Quizlet or Anki. Free, no account needed.
Example Algorithms flashcards
What is an algorithm?
A step-by-step procedure to solve a problem or compute a result, with a defined input, output, and finite number of operations.
What does Time Complexity measure?
The number of elementary operations an algorithm performs as a function of input size n, expressed in Big-O notation (worst-case, average-case, or best-case).
What does Space Complexity measure?
The total amount of memory (RAM) an algorithm uses relative to input size n, including auxiliary space for variables, recursion stacks, and data structures.
What is the difference between O(n) and O(n²)?
O(n) is linear—doubling input roughly doubles operations. O(n²) is quadratic—doubling input roughly quadruples operations. O(n²) degrades much faster for large inputs.
What is the time–space complexity trade-off?
Often optimizing for faster runtime requires more memory, and vice versa. Example: hash tables are O(1) lookup (space cost) vs. sorted arrays that are O(log n) but use less memory.
What is a greedy algorithm and when does it work?
An algorithm that makes locally optimal choices at each step, hoping to find a global optimum. Works only when the problem has the 'greedy choice property' (local optimality guarantees global optimality), like Dijkstra's or activity selection.
What is dynamic programming and how does it differ from greedy?
DP solves overlapping subproblems by storing results (memoization/tabulation) and building up solutions; it guarantees correctness for problems with optimal substructure. Greedy doesn't revisit subproblems and can fail on non-greedy-choice problems (e.g., coin change).
What is divide-and-conquer? Give an example.
A paradigm that breaks a problem into independent subproblems, solves each recursively, then combines results. Example: merge sort divides array in half, sorts each half, merges them. Time: O(n log n).
When should you choose a hash table over a sorted array?
Hash table if you need O(1) average lookup/insert and don't need ordered traversal or range queries. Sorted array if you need O(log n) search, order, or range scans—and can afford O(n) insertion.
What is amortized complexity and why is it useful?
The average cost per operation over a sequence of operations, not per single operation. Example: dynamic array append is O(1) amortized even though occasional resizing is O(n), because resizing happens rarely. Matters for real performance in tight loops.
Make your own Algorithms study set
Flashcards for related topics
Studying Algorithms to build with AI? MindloomHQ turns it into real skills — structured courses, agent projects, and certificates.
Explore MindloomHQ →