c++ - Hash Tables: why doesn't this code resolve collisions? -


This entry function is not properly inserted and does not overwrite the previous entries. Apart from this, duplicate check does not work and only works half-time.

  HT :: HT (Konsted unsigned & amp; tblSize) {// hash table size is equal to size or default size TBL_SIZE hsize = tblSize; // pointer table defualt 0 psize = 0; // reisze table hTable.resize (hsize); PTable.resize (hsize); // Set the uncertain values ​​to blank ($$$) (unsigned i = 0; i   

It starts inserting and duplicate key works on a data set, but not with other data values, which fills tables TBL_SIZE = 31 apart from this free continuous Defines all vector values ​​to specify free space for $$$.

  // in the hash table with linear probes as collision resolution ( HTable [(index + i)% hsize] .key == free) {hTable [index] = records;   

You do not want to include [index], when [(index + i)% hsize] is free space.

Comments

Popular posts from this blog

Verilog Error: output or inout port "Q" must be connected to a structural net expression -

jasper reports - How to center align barcode using jasperreports and barcode4j -

c# - ASP.NET MVC - Attaching an entity of type 'MODELNAME' failed because another entity of the same type already has the same primary key value -