InterviewStack.io LogoInterviewStack.io

Algorithms and Data Structures Questions

Comprehensive understanding of core data structures such as arrays, linked lists, stacks, queues, hash tables, trees, heaps, and graphs, and fundamental algorithms including sorting, searching, traversal, string manipulation, and graph algorithms. Ability to analyze and compare time and space complexity using asymptotic notation such as Big O, Big Theta, and Big Omega, and to reason about trade offs between different approaches. Skills include selecting the most appropriate data structure for a problem, designing efficient algorithms, applying algorithmic paradigms such as divide and conquer, dynamic programming, greedy methods, and graph search, and implementing correct and robust code for common interview problems. At more senior levels, this also covers optimizing for large scale through considerations of memory layout, caching, amortized analysis, parallelism and concurrency where applicable, and profiling and tuning for performance in realistic systems.

HardSystem Design
75 practiced
Design an adaptive sampling algorithm for distributed tracing that keeps storage bounded while preserving good coverage for high-error or high-latency requests. Describe data structures to identify candidate traces for increased sampling, feedback loops from offline analysis, and how to maintain per-service budgets while reacting to anomalies.
HardTechnical
79 practiced
Given a hot path that iterates over an array of struct objects, propose algorithmic and memory-layout optimizations (struct-of-arrays vs array-of-structs, prefetching, alignment, padding) to improve CPU cache utilization and reduce latency. Provide pseudocode and describe which runtime metrics you would collect to verify improvements as an SRE.
HardTechnical
138 practiced
Implement (conceptually or code sketch) the Aho-Corasick automaton to search for thousands of patterns simultaneously in a stream of log text. Explain building the trie with failure links, how matching proceeds, and why this approach is advantageous for multi-pattern detection in intrusion detection or log-alerting pipelines.
MediumTechnical
84 practiced
Implement an LRU cache class in Python with methods get(key) and put(key, value). Requirements: both operations O(1), fixed capacity, evict least-recently-used item when full. Provide a usage example and explain the two data structures you used and why they achieve O(1) complexity.
HardTechnical
77 practiced
Implement Tarjan's algorithm in Python to compute strongly connected components (SCCs) of a directed graph and return SCCs that contain more than one node (i.e., cycles). Explain the role of index and lowlink values, the recursion stack, and the time/space complexity. Describe how this helps detect cyclic service dependencies.

Unlock Full Question Bank

Get access to hundreds of Algorithms and Data Structures interview questions and detailed answers.

Sign in to Continue

Join thousands of developers preparing for their dream job.