From 93b0920dbcc987329d093756d20dfab71fbee8c4 Mon Sep 17 00:00:00 2001 From: anushkachauhan Date: Thu, 10 Oct 2019 01:11:02 +0530 Subject: [PATCH] Added comment --- hash_table.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/hash_table.cpp b/hash_table.cpp index 11b3993..6578485 100644 --- a/hash_table.cpp +++ b/hash_table.cpp @@ -27,7 +27,7 @@ using namespace std; #define EXPAND_FACTOR 0.7 // The factor to indicates when it's time to expand the hash table // The two defines above are used to have a more static hash table which also allows more optimization -// Base class for the Hash Table +// Base class to create the Hash Table class HashTable { public: HashTable() { @@ -78,7 +78,7 @@ class HashTable { } return false; } - void display() { + void display() { // to display the hashtable contents for(int i = 0; i < this->table_size; i++) { if (hash_table[i] != 0) { cout<table_size); } @@ -130,7 +131,7 @@ class HashTable { int old_table_size = this->table_size; this->hash_table = new_table; this->table_size = this->table_size * 2; - memset(this->hash_table, 0, sizeof(int) * STARTING_SIZE); + memset(this->hash_table, 0, sizeof(int) * STARTING_SIZE); // inserting default value 0 to hash table // Insert all values again, now the position(hash) could have changed because of the new table size for(int i = 0; i < old_table_size; i++) { if (old_table[i] != 0) {