Thanks everyone for your reply. OK, I have now decided that I need 3 states and two won't be enough, so I guess that means an enum is more efficient and better in this case. Only problem is I haven't used enum before, so I don't know how to use it. If I had a boolean array, I would have gone ahead this way (since it is bool, just two states):
Now, how can I do the same with enums wit 3 states. I have declared the enum with 3 states thus:
bool occupied ;
//fill array with default values, to avoid it holding undefined values
for(int i = 0; i < tableSize; ++i)
occupied[i] = false;
//then later change each index as you fill in each place in the //hashtable, e.g. change value of index 5 to true:
occupied = true;
now how can I "fill" them with default values, say occupied, like was the case with the boolean array? I can't do it like this since states has only 3 values, so then index is from 0 to 3 but my tableSize can be as big as 100,000. So, unlike in the boolean case, I can't do this.
//Then declare it as:
So, how could this be done with enum? Thanks in advance.
for int i = 0; i < tableSize; ++i;
states[i] = occupied;
//and then later change each state as it changes.