Linear Probing with Hashing

So i'm supposed to implement some code using linear probing for hashing, but i'm not sure I understand completly how this is done. Infact i'm not sure how to implement any of the code because they didn't make that clear in class.

either way here is the full code that's supposed to be implemented. I apprecite any help I can get at this point.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
  #ifndef HASHTABLE_H
#define HASHTABLE_H

template <typename HashElement>
class HashTable
{
private:
	// internal datastructure

	int nrOfCollisions;
	int hashTableSize;
	int myHash(const HashElement& elem) const
	{
		static Hash<HashElement> hashFunc;
		return hashFunc(elem) % hasTableSize; // hashFunc(elem) is a call of the defined operator() for HashElement
	}
public:
	HashTable(int hashTableSize = 101);
	HashTable(const HashTable& aTable);
	virtual ~HashTable();
	HashTable& operator=(const HashTable& aTable);
	bool contains(const HashElement& elem) const;
	bool insert(const HashElement& elem);
	bool remove(const HashElement& elem);
	void makeEmpty();
	double loadFactor() const;
	int getNrOfElements() const;
	int getHashTableSize() const;
	int getNrOfCollisions() const;
	void resetNrOfCollisions();
};

#endif 
Do your own homework, dude from Blekinge institute of technology.. Else I'll tell on you to teachers. Just saying. Do your own goddamn homework. This was suppose to be a homework, not something you suppose to ask on the internet... There are bunch of references you can benefit from algorithm book we have.
Last edited on
... else*

//If you think the ellipsis represents a delay within an as-yet-incomplete sentence, but you've decided you don't want indicate that delay using some other punctuation (comma, semicolon, etc.), then just continue the sentence without a capital.

supposed*
you're*
supposed*


The second use of ellipsis is correct.
//In general, it really depends on whether you consider the ellipsis represents an "empty" pause at the end of a preceding sentence. If so, what follows is a new sentence, then it starts with a capital letter.
Effectively, it's partly the exact context, and partly stylistic preference. I'd say if in doubt, consider using a comma instead of an ellipsis. If that doesn't feel right, you should probably capitalise.

The last sentence is pretty much full on chaos.


There are a bunch of references that you can benefit from in algorithm book that we have.*
Topic archived. No new replies allowed.