hash - extendible hashing - destructor C++ -


so... have implemented version of exendible hashing...my question destructor.

i used in hash class array of pointers point on buckets class bucket. problem there can multiple pointers on same bucket.

in destructor of hash class have delete every bucket , array, have careful not delete same bucket twice (i think that'll result in error). in order used bool vector memorize whether or not bucket has been deleted.

my question now: there way know if bucket has been deleted without using more memory (the bool vector) ?

le: solved destructor problem using nullptr (seems working now), but...another question: how can go through every bucket 1 time (for finding min , max elements, example). can't use nullptr time (the pointers need stay - on buckets)

just iteratively use erase function

while (size ()) {     erase(begin()); } 

Comments

Popular posts from this blog

c# - Validate object ID from GET to POST -

node.js - Custom Model Validator SailsJS -

php - Find a regex to take part of Email -