Integers are sequentially added to the table and it is not known in advance how many will be — maybe 20, or maybe 1000. Therefore, it is necessary, each time all cells are filled, to increase the size of the table. The hash function will be the simplest:
return number%hashSize; where hashSize is the size of the table at the current moment, number is the current number to be added.
Let initially the size of the table 10. Add the number 15. It goes into the fifth cell (15% 10 = 5). Then, after some time, when the size of the table becomes different, for example, 20, we add once again the number 15. And it will already go to another cell, in the 15th (15% 20 = 15). Although for correct work I had to go to the 5th.
What do they do in such cases?