heap - Constructing a data structure with specific requirements -


i need construct data structure uses o(n) bits of storage. worst time complexity of insert, delete, , maximum needs o(log n) needs o(1) contains. have been trying use binary heap 1s , 0s (to satisfy o(n) bits of storage) can't seem far maximum , contains functions (on how worst time complexity looks). can give me clue on i'm going wrong? thank you.

have 2 data structures working tandem: balanced bst (such avl tree) , hash table. inserting element takes o(log(n)) time bst, o(1) time hash table, o(log(n)) time total. deletion takes o(log(n)) time bst, o(1) time hash table. maximum takes o(log(n)) time bst, , once know element maximum, takes o(1) time hash table. contains takes o(1) time hash table (after theres no need check bst, since contain same elements). implementing difficult because you'd need keep pointers between elements in bst , hash table, structure achieves required specifications.


Comments

Popular posts from this blog

authentication - Mongodb revoke acccess to connect test database -

r - Update two sets of radiobuttons reactively - shiny -

ios - Realm over CoreData should I use NSFetchedResultController or a Dictionary? -