Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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
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 oldArray-array; // Create new double-sized, empty table array.resize 2 oldArray.size )); for( auto & entry array) entry. info EMPTY; // Copy table over currentSize = 0; for( auto& entry:oldArray if( entry. info ACTIVE ) insert( std: :move( entry.element ) ); 8. [4] Time for some heaping fun! What's the time complexity for these functions in a binary heap of size N? Functiorn insert(x) findMin() deleteMin) buildHeap( vector(1...N] ) Big-0 complexity
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started