7. [3] I grabbed some code from the Internet for my linear probing based hash ta
ID: 3606924 • Letter: 7
Question
7. [3] I grabbed some code from the Internet for my linear probing based hash table because the Internet's always right. The hash table works, but once I put more than a few thousand entries, the whole thing starts to slow down Searches, inserts, and contains calls start taking *way* longer than 0(1) time and my boss is pissed because it's slowing down the whole application services backend I'm in charge of. I think the bug is in my rehash code, but I'm not sure where. Any ideas why my hash table starts to suck as it grows bigger? * Rehashing for linear probing hash table. void rehash() vector oldArrayarray; // Create new double-sized, empty table array.resize( 2 * oldArray.size( ) ) for( auto& entry array) entry.infoEMPTY; ICopy table over currentSize -0; for( auto& entryoldArray if( entry, info ACTIVE ) insert std: :move entry.element))Explanation / Answer
How many times are you calling the rehash function?
How many times rehash function is called?
When resizing the hash it expands than expected memory size and check if there is any global variable.
Whenever a function or variable is declared , heap sizes expands and affects the memory.
Please share the entire code for more probing
How many times rehash function is called?
When resizing the hash it expands than expected memory size and check if there is any global variable.
Whenever a function or variable is declared , heap sizes expands and affects the memory.
Please share the entire code for more probing
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.