0

Hey guys. I'm new to this site. I just wanted someone to look over the code I have so far for a hash table that operates on linear probing. I don't have anyone to really check these things for me as my professor is always busy. Can anyone tell me if there are any bugs, errors, typos, etc?

This code compiles, but has I think 2 warnings. Please give me some feedback if you have the chance. It would be much appreciated.

include <iostream>

using namespace std;
const int tablesize=1001;
int lcounter=0;//# of linear probes
int qcounter=0;//# of quadratic probes
class HashTable
{
public:
int Table[tablesize];

HashTable(){
for(int i=0; i<1001; i++){
Table[i]=NULL;
}
}

void linearinsert(int key){
for(int stepsize = 1; stepsize<1001; stepsize++){
if(Table[key+stepsize%tablesize]==NULL){
++lcounter;
Table[key+stepsize%tablesize]==key;
}
if(Table[key+stepsize%tablesize]!=NULL){
++lcounter;
}
else{
cout<<"error, table is full";
}
}
}
void quadraticinsert(int key){

};

1
Contributor
1
Reply
2
Views
5 Years
Discussion Span
Last Post by MastrLuigi
0

I have yet to finish the quadratic insert function, but is everything up until that point ok?

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.