Flashcard Deck · 21 cards · Public

Data Structures & Algorithms - Essential Interview Prep

Master essential Data Structures & Algorithms for your next technical interview! This high-yield flashcard deck covers key algorithmic patterns, graph traversals, dynamic programming, and sorting techniques, complete with complexities and practical use cases.

Cards in this deck

(21 cards)

Preview terms and definitions before starting your study session.

#1
Term
What is Time Complexity and how is it expressed?
Definition
Measures how the runtime of an algorithm scales with the input size . It's expressed using Big O notation, focusing on the upper bound of growth (e.g., , , , , ).
#2
Term
What is Space Complexity and common examples?
Definition
Measures the amount of auxiliary memory an algorithm uses relative to the input size . Examples include for constant space, for linear space (e.g., an array of size ), and for recursive call stacks in some algorithms.
#3
Term
Explain Breadth-First Search (BFS) and its typical use cases.
Definition
A graph traversal algorithm that explores all nodes at the current depth level before moving to the next. It uses a queue. Common uses: shortest path in unweighted graphs, level order tree traversal, finding connected components. Time/Space: .
#4
Term
Explain Depth-First Search (DFS) and its typical use cases.
Definition
A graph traversal algorithm that explores as far as possible along each branch before backtracking. It uses a stack (or recursion). Common uses: cycle detection, topological sort, pathfinding, connected components. Time/Space: .
#5
Term
What are the key differences between BFS and DFS?
Definition
BFS explores level by level, guarantees shortest path in unweighted graphs, uses a queue. DFS explores depth-first, good for cycle detection and topological sort, uses a stack (or recursion). BFS is generally iterative, DFS can be recursive or iterative.
#6
Term
Describe Dijkstra's Algorithm and its time complexity.
Definition
A greedy algorithm for finding the shortest paths from a single source node to all other nodes in a graph with non-negative edge weights. It uses a min-priority queue. Time complexity: or with a binary heap.
#7
Term
What is Topological Sort and when is it used?
Definition
A linear ordering of vertices in a Directed Acyclic Graph (DAG) such that for every directed edge u -> v, u comes before v in the ordering. Used for task scheduling with dependencies (e.g., build systems, course prerequisites). Time complexity: .
#8
Term
Explain the Two Pointers algorithmic pattern.
Definition
Involves using two pointers (indices) that iterate through a data structure (e.g., array, string) from different positions (e.g., start/end, or both from start at different speeds) to solve problems efficiently, often reducing time complexity from to .
Showing 8 of 21 cards in this deck.
Study All Now