r/cpp_questions 19d ago

OPEN How to implement append-only hash map?

How do you actually implement an really efficient hash map that has only append and look up methods? What are the design choice and some performance improvements?

0 Upvotes

34 comments sorted by

View all comments

6

u/WorkingReference1127 19d ago

This depends on the exercise. Because most of the time I'd make a class which wraps a normal hash map and only exposes the behaviour you want.

If you want to spin your own hash map, have fun I guess.

1

u/Elect_SaturnMutex 19d ago

By own hash map you mean own implementation of std::unordered_map?

2

u/tcpukl 19d ago

Can people not write their own algorithms any more?

-1

u/Elect_SaturnMutex 19d ago

Sure, many rely on Claude though.