Challenge: Implement a Custom Hash Table
Taak
Swipe to start coding
In this challenge, you will implement a hash table using chaining to resolve collisions. Your implementation must support three operations:
Required Behavior
put(key, value):- Insert a key-value pair into the table.
- If the key already exists, update its value.
get(key):- Return the value for the given key.
- If the key does not exist, return
None.
delete(key):- Remove the key-value pair from the table.
- If the key does not exist, do nothing.
Chaining Requirements
- The table consists of an array of buckets.
- Each bucket stores a list of (key, value) pairs.
- Collisions are handled by appending to the appropriate list.
Oplossing
Was alles duidelijk?
Bedankt voor je feedback!
Sectie 1. Hoofdstuk 4
single
Vraag AI
Vraag AI
Vraag wat u wilt of probeer een van de voorgestelde vragen om onze chat te starten.
Geweldig!
Completion tarief verbeterd naar 7.69
Challenge: Implement a Custom Hash Table
Veeg om het menu te tonen
Taak
Swipe to start coding
In this challenge, you will implement a hash table using chaining to resolve collisions. Your implementation must support three operations:
Required Behavior
put(key, value):- Insert a key-value pair into the table.
- If the key already exists, update its value.
get(key):- Return the value for the given key.
- If the key does not exist, return
None.
delete(key):- Remove the key-value pair from the table.
- If the key does not exist, do nothing.
Chaining Requirements
- The table consists of an array of buckets.
- Each bucket stores a list of (key, value) pairs.
- Collisions are handled by appending to the appropriate list.
Oplossing
Was alles duidelijk?
Bedankt voor je feedback!
Sectie 1. Hoofdstuk 4
single