Question DSA-HASH-0079
HardWhich data structure gives O(1) average insert, delete and getRandom?
- A.
A balanced BST
- B.
A heap
- C.
Sign up free to see the answer and a step-by-step explanation.
Popular companies
Prepare company by company
Hiring pattern, syllabus, past questions and mocks for each company.
All companiesPractice by subject
Hashing question
Which data structure gives O(1) average insert, delete and getRandom?
A balanced BST
A heap
Sign up free to see the answer and a step-by-step explanation.
A linked list
A hash map from value to index plus an array, swapping the deleted element with the last