Greetings,
I'm currently working on a hash map struct, but I'm not sure whether I should base it on a hashmap or two arrays of size 8191. I wish to be able to efficiently iterate through all mappings as I intend to provide a for-each functionality, but I'm not sure which is more efficient: always taking up space for two arrays with capacity 8191 or always iterating through all possible key values. Both seem pretty bad. Also: Is it really true that array capacities cannot be dynamically defined - must they really be set when the array is declared? I suppose a compromise would be having both a hashtable and one array of size 8191 where the array stores every key in the hashtable with an assigned value. This would cut the overhead in half while rendering the tedious iteration through all possible keys superfluous, but it sure as hell isn't pretty.
Thanks.
I'm currently working on a hash map struct, but I'm not sure whether I should base it on a hashmap or two arrays of size 8191. I wish to be able to efficiently iterate through all mappings as I intend to provide a for-each functionality, but I'm not sure which is more efficient: always taking up space for two arrays with capacity 8191 or always iterating through all possible key values. Both seem pretty bad. Also: Is it really true that array capacities cannot be dynamically defined - must they really be set when the array is declared? I suppose a compromise would be having both a hashtable and one array of size 8191 where the array stores every key in the hashtable with an assigned value. This would cut the overhead in half while rendering the tedious iteration through all possible keys superfluous, but it sure as hell isn't pretty.
Thanks.