InterviewStack.io LogoInterviewStack.io

Data Structures and Complexity Questions

Comprehensive coverage of fundamental data structures, their operations, implementation trade offs, and algorithmic uses. Candidates should know arrays and strings including dynamic array amortized behavior and memory layout differences, linked lists, stacks, queues, hash tables and collision handling, sets, trees including binary search trees and balanced trees, tries, heaps as priority queues, and graph representations such as adjacency lists and adjacency matrices. Understand typical operations and costs for access, insertion, deletion, lookup, and traversal and be able to analyze asymptotic time and auxiliary space complexity using Big O notation including constant, logarithmic, linear, linearithmic, quadratic, and exponential classes as well as average case, worst case, and amortized behaviors. Be able to read code or pseudocode and derive time and space complexity, identify performance bottlenecks, and propose alternative data structures or algorithmic approaches to improve performance. Know common algorithmic patterns that interact with these structures such as traversal strategies, searching and sorting, two pointer and sliding window techniques, divide and conquer, recursion, dynamic programming, greedy methods, and priority processing, and when to combine structures for efficiency for example using a heap with a hash map for index tracking. Implementation focused skills include writing or partially implementing core operations, discussing language specific considerations such as contiguous versus non contiguous memory and pointer or manual memory management when applicable, and explaining space time trade offs and cache or memory behavior. Interview expectations vary by level from selecting and implementing appropriate structures for routine problems at junior levels to optimizing naive solutions, designing custom structures for constraints, and reasoning about amortized, average case, and concurrency implications at senior levels.

EasyTechnical
100 practiced
Compare memory layout and performance implications of using raw char arrays (C-style strings), std::string in C++, and System.String in C# for in-game text processing (UI, chat, subtitles). Discuss contiguous vs non-contiguous storage, immutability, copy semantics, UTF-8/UTF-16 considerations, and cache effects in tight loops such as rendering many short strings every frame.
MediumTechnical
83 practiced
Implement an LRU cache suitable for streaming in-game assets in C++ or C#. The class should support get(key) -> Asset and put(key, Asset) with O(1) average time for both operations. Show code or pseudocode, explain memory overhead, and describe how you'd modify eviction to use memory size threshold instead of count.
MediumTechnical
77 practiced
Given the following pseudocode used in a per-frame sorting stage of a game pipeline, derive its time complexity and suggest a more efficient alternative. Explain the impact on frame time when n is the number of visible objects:
for i in 0..n-1: for j in i+1..n-1: if arr[j] < arr[i]: swap(arr[i], arr[j])
Identify the algorithm and recommend practical optimizations for real-time rendering.
HardSystem Design
97 practiced
For a multiplayer authoritative server, design data structures and algorithms to synchronize frequently changing game object states across clients while minimizing bandwidth. Discuss per-object diffs, delta compression, checksums, and Merkle trees for mismatch detection. Analyze CPU cost to compute diffs and memory needed to store historical states for rollback or reconciliation.
EasyTechnical
82 practiced
Explain the following time complexities with a short intuitive description and a concrete game-related example for each: O(1), O(log n), O(n), O(n log n), O(n^2), O(2^n). Also explain the difference between worst-case, average-case, and amortized complexity, using a game example for amortized complexity.

Unlock Full Question Bank

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

Sign in to Continue

Join thousands of developers preparing for their dream job.