r/C_Programming • u/Significant_Ant9861 • Aug 08 '26
Hash table
I am newbie and a beginner in c language. I would like to learn the hash table for my next semester.
I kindly ask for some help in this matter. I still struggle in the basics even using the ai models.
7
Upvotes
View all comments
Show parent comment
1
u/flatfinger Aug 10 '26
I prefer the chain-bucket hashing approach exemplified by the .NET
Dictionary<TKey,TValue>class. Such an approach makes it easy to enumerate items in order of addition if the only way items are deleted is by bookmarking the collection's state and then reverting to an earlier bookmark. If the collection's backing store is pre-allocated to maximum capacity, simply reducing the "number of items in the collection" value to N will eliminate all but the first N items in the collection, no matter how many items had been added since that.