← eBay Interview Insights

eBay·Software Engineer·Onsite - Coding / Algorithms·Intermediate

Intermediate
Jun 2026

Summary

eBay software engineer interview with a coding round focused on designing an in-memory file system from scratch. Pretty straightforward if you've thought about hash maps before, but the listing requirement with custom sort order added some wrinkles worth thinking through.

Questions Asked (1)

Q1

Design an in-memory file system that supports adding files (with a name and size), retrieving a file's size, deleting files, and listing all files sorted by size descending with ties broken alphabetically. Discuss the data structures you'd use.

Algorithms & Data StructuresSystem DesignTechnical Trade-offs
Author's notes

I went straight to a hash map for the core CRUD stuff and that part was fine.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by clarifying requirements and constraints, then propose a hybrid data structure that combines a hash map for O(1) file operations with a balanced BST or skip list for efficient sorted listing. Discuss trade-offs between different approaches and justify your choices based on expected usage patterns.

Pro tip: Mention that you would use a hash map for O(1) lookups and a balanced BST (or skip list) for maintaining sorted order, but also discuss the trade-off of using a single data structure like a treap or a combination of hash map and sorted list with lazy sorting for different operation frequencies.

1. Clarify Requirements and Constraints

Ask about expected file sizes, frequency of operations, memory constraints, and whether concurrent access is needed. This shows you think about real-world scenarios before diving into design.

2. Propose Data Structures

Suggest using a hash map (dictionary) for O(1) add, get, and delete operations, and a balanced binary search tree (or skip list) to maintain files sorted by size descending and name ascending for efficient listing.

3. Analyze Time and Space Complexity

Explain that add, get, and delete are O(1) average with hash map, and listing is O(n) to traverse the BST. Space is O(n) for storing files. Discuss how the BST operations (insert, delete) are O(log n).

4. Discuss Trade-offs and Alternatives

Compare with using only a sorted list (O(n) insert/delete) or only a hash map (O(n log n) sort on each list). Mention that a treap or skip list could combine both but may have higher constant factors.

5. Consider Edge Cases and Optimizations

Address duplicate names, updating file sizes, and memory overhead. Suggest lazy deletion or periodic rebalancing if needed. Mention that for small n, a simple list with sorting might suffice.

Key Points to Mention

  • Hash map for O(1) average-case add, get, and delete operations.
  • Balanced BST (e.g., red-black tree) or skip list for maintaining sorted order by size descending and name ascending.
  • Time complexity: O(1) for add/get/delete, O(n) for listing, O(log n) for BST insert/delete.
  • Space complexity: O(n) for storing file metadata.
  • Trade-offs: using a single data structure like a treap vs. combining hash map and BST.
  • Edge cases: duplicate file names, updating file sizes, and handling deletions in the BST.

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