Question 34 (DS)

How can you design a data structure that can do the following operations in O(1) time:
Insert, Delete, Search, Max which returns the maximum number
I know delete, search and insert can be done O(1) time in a hashmap with a proper hash function. But not sure Max is even possible in O(1) with the presence of delete operation?

[advanced_iframe securitykey=”undefined” src=”https://ide.kodnest.com/?L2Jf” width=”100%” height=”600″]

KodNest Training New Batch is starting on 21st September 2020. Attend one week free demo classes.Register Now

New Report

Close