3 ms·
> A map or pretty much any nontrivial data structure is not a flat region. Not necessarily. A hashmap can be implemented in a way it stores both the keys and v
by pkolaczk 5y ago
> A map or pretty much any nontrivial data structure is not a flat region.
Not necessarily. A hashmap can be implemented in a way it stores both the keys and values in a flat memory region, as long as keys and values are fixed size, and such a structure is way more efficient that traditional array-of-pointers implementation, where fetching each key requires following a pointer and getting the value requires following another pointer.
- amluto 5y agoThe resulting code will still be asymptotically slow.