InterviewStack.io LogoInterviewStack.io

Fundamental Algorithms and Techniques Questions

Covers core algorithmic concepts and problem solving patterns commonly assessed in technical interviews. Topics include searching algorithms such as binary search; sorting algorithms such as merge sort and quick sort; graph traversal methods such as breadth first search and depth first search; recursion and divide and conquer techniques; greedy heuristics; and dynamic programming including memoization and tabulation. Also includes implementation patterns such as two pointers, sliding window, prefix sums, and divide and conquer composition, as well as practical considerations like in place versus out of place implementations, stability for sorting, recursion stack and memory usage, and amortized analysis. Candidates should be able to implement these algorithms correctly, explain correctness and trade offs, analyze time and space complexity using Big O notation for best case average case and worst case, select appropriate approaches given input constraints, combine patterns to solve composite problems, and optimize or refactor solutions while handling edge cases.

HardTechnical
75 practiced
Given a weighted directed graph, compare Dijkstra vs Bellman-Ford vs Floyd-Warshall for computing shortest paths. For a large sparse graph representing distances between entities in an ML feature graph, which algorithm would you choose and why? Provide complexity analysis and discuss negative edge weights implications.
MediumTechnical
62 practiced
Design an algorithm to maintain the median of a sliding window over an integer stream of fixed size w. Provide a data structure approach (e.g., two heaps) and discuss how to handle deletions efficiently, time/space complexity, and practical considerations for anomaly detection in real-time ML pipelines.
MediumTechnical
119 practiced
Given a directed graph, write a Python function to detect if it contains a cycle using DFS and node coloring (white/gray/black). Explain why this detects back-edges and where cycle detection fits in ML pipelines (e.g., validating feature dependency graphs).
MediumTechnical
90 practiced
Explain the 0/1 Knapsack problem and contrast full DP solution vs a greedy approximation. Provide a scenario in ML engineering where a greedy approach might be acceptable (e.g., pruning features under strict latency) and where exact DP is necessary (e.g., constrained resource allocation). Outline implementations and complexity trade-offs.
HardTechnical
65 practiced
Explain median-of-medians selection algorithm that achieves worst-case O(n) time. Provide a high-level description and sketch of proof for linear time, and discuss practicality vs randomized Quickselect in ML systems that require strict upper bounds on latency.

Unlock Full Question Bank

Get access to hundreds of Fundamental Algorithms and Techniques interview questions and detailed answers.

Sign in to Continue

Join thousands of developers preparing for their dream job.