(Solved):Using C++ to write a program to compute the number of collisions required in a long random sequence of insertions using linear probing, quadratic probing, and double hashing. View Answer…

 

Question

Using C++ to write a program to compute the number of collisions required in a long random sequence of insertions using linear probing, quadratic probing, and double hashing.

 

EXPERT ANSWER

Here’s the code for this ->

#include <iostream>
#include <cstdlib>
#include <stdio.h>
#include <ctime>
#include <vector>
#include <string>
#include <fstream>
using namespace std;
enum collisionResolutionType { LINEAR_PROBING, QUADRATIC_PROBING, DOUBLE_HASHING };
const int SIZE = 23;
struct node {
   int val;
   node* next;
};
// For getting data
vector<int> arrayOfHashTables[3][16];
vector<node*> chainingHashTable[16];
int totalComparisons[4][16];
int totalInsertions[16];
double

Scroll to top