← Radix Trading Interview Insights

Radix Trading·Software Engineer·Technical Phone Screen·Intermediate

Intermediate
May 2026

Summary

One coding round for a quant researcher role at Radix Trading, focused on C++. The poster mentioned the content probably shifts depending on which research lead you're interviewing with, but the core team seems to run pure C++ problems.

Questions Asked (1)

Q1

Implement a rolling median in C++.

Algorithms & Data Structures
Author's notes

This is a classic two-heap setup but doing it cleanly in C++ under pressure is a different story.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Use two heaps (a max-heap for the lower half and a min-heap for the upper half) to maintain the median in O(log n) insertion time and O(1) query time. Clearly explain the balancing logic and how to handle even/odd counts. Discuss potential optimizations like using a single multiset or a Fenwick tree for specific constraints.

Pro tip: Mention that in trading systems, latency matters, so you might use a fixed-size circular buffer with two heaps if the window size is known, or consider a balanced BST for dynamic windows. Also, discuss how to handle duplicate values and integer overflow.

1. Clarify requirements

Ask whether the rolling median is over a fixed-size window or a growing stream, and whether deletions are needed. This determines the data structure choice.

2. Choose data structures

For a stream with insertions only, two heaps work well. For a sliding window with deletions, consider a multiset or two multisets with lazy deletion.

3. Outline the algorithm

Explain how to insert: add to max-heap if value <= max-heap top, else min-heap; then rebalance so sizes differ by at most 1. For median, if sizes equal, average tops; else return top of larger heap.

4. Handle edge cases

Discuss empty stream, single element, duplicates, and negative numbers. Also mention integer overflow when averaging two large ints.

5. Analyze complexity and trade-offs

State time complexity: O(log n) per insertion, O(1) median. Space O(n). Compare with alternatives like balanced BST (O(log n) insert/delete) or Fenwick tree (O(log n) with coordinate compression).

Key Points to Mention

  • Two-heap approach: max-heap for lower half, min-heap for upper half.
  • Balancing condition: sizes differ by at most 1, and all elements in max-heap <= all in min-heap.
  • Median calculation: average of tops if even, top of larger heap if odd.
  • Handling deletions for sliding window: lazy deletion or multiset.
  • Time complexity: O(log n) insertion, O(1) median; space O(n).
  • Edge cases: empty stream, duplicates, integer overflow in average.

AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.