PracHub
QuestionsPremiumCoachesLearningGuidesInterview Prep
|Home/Coding & Algorithms/Paradromics

Implement a hash table with put/get

Last updated: Mar 29, 2026

Quick Overview

This question evaluates implementation and design skills for hash-based data structures, testing competency in data structures, hashing, collision handling, and achieving expected O(1) put/get performance in the Coding & Algorithms domain.

  • medium
  • Paradromics
  • Coding & Algorithms
  • Software Engineer

Implement a hash table with put/get

Company: Paradromics

Role: Software Engineer

Category: Coding & Algorithms

Difficulty: medium

Interview Round: Technical Screen

## Problem Implement a simplified hash table (hash map) data structure from scratch. ### Required API Design a class `HashTable` with: - `HashTable(int numBuckets)` (constructor): initialize internal storage with a fixed number of buckets. - `void put(K key, V value)`: insert a key/value pair. If the key already exists, overwrite its value. - `V get(K key)`: return the value for `key`, or a sentinel (e.g., `null` / `-1`) if the key is not present. **Note:** `delete/remove` is *not* required. ### Assumptions / Constraints - You may assume keys are non-null. - You must handle hash collisions correctly. - Target average time complexity: `O(1)` for `put` and `get` (amortized/expected). - You may not use a built-in hash map/dictionary. ### Follow-up discussion (conceptual) 1. What makes a hash function “good,” and how does key distribution affect performance? 2. How does the choice of `numBuckets` (and the load factor) impact collisions and runtime? 3. Compare common collision-resolution strategies: - Separate chaining (buckets) - Open addressing (e.g., linear/quadratic probing, double hashing) 4. If using open addressing, describe how probing (“hopping”) works and what pitfalls it introduces (e.g., clustering, tombstones).

Quick Answer: This question evaluates implementation and design skills for hash-based data structures, testing competency in data structures, hashing, collision handling, and achieving expected O(1) put/get performance in the Coding & Algorithms domain.

Related Interview Questions

  • Compute ways to climb n steps - Paradromics (medium)
Paradromics logo
Paradromics
Mar 1, 2026, 12:00 AM
Software Engineer
Technical Screen
Coding & Algorithms
2
0

Problem

Implement a simplified hash table (hash map) data structure from scratch.

Required API

Design a class HashTable with:

  • HashTable(int numBuckets) (constructor): initialize internal storage with a fixed number of buckets.
  • void put(K key, V value) : insert a key/value pair. If the key already exists, overwrite its value.
  • V get(K key) : return the value for key , or a sentinel (e.g., null / -1 ) if the key is not present.

Note: delete/remove is not required.

Assumptions / Constraints

  • You may assume keys are non-null.
  • You must handle hash collisions correctly.
  • Target average time complexity: O(1) for put and get (amortized/expected).
  • You may not use a built-in hash map/dictionary.

Follow-up discussion (conceptual)

  1. What makes a hash function “good,” and how does key distribution affect performance?
  2. How does the choice of numBuckets (and the load factor) impact collisions and runtime?
  3. Compare common collision-resolution strategies:
    • Separate chaining (buckets)
    • Open addressing (e.g., linear/quadratic probing, double hashing)
  4. If using open addressing, describe how probing (“hopping”) works and what pitfalls it introduces (e.g., clustering, tombstones).

Submit Your Answer to Earn 20XP

Sign in to leave a comment

Loading comments...

Browse More Questions

More Coding & Algorithms•More Paradromics•More Software Engineer•Paradromics Software Engineer•Paradromics Coding & Algorithms•Software Engineer Coding & Algorithms
PracHub

Master your tech interviews with 8,000+ real questions from top companies.

Product

  • Questions
  • Learning Tracks
  • Interview Guides
  • Resources
  • Premium
  • For Universities
  • Student Access

Browse

  • By Company
  • By Role
  • By Category
  • Topic Hubs
  • SQL Questions
  • Compare Platforms
  • Discord Community

Support

  • support@prachub.com
  • (916) 541-4762

Legal

  • Privacy Policy
  • Terms of Service
  • About Us

© 2026 PracHub. All rights reserved.