my code stock.com

Hpp file

Snippet options

Download: Download snippet as hashtable.c.
Copy snippet: For this you need a free my code stock.com account.
Embed code : You will find the embed code for this snippet at the end of the page, if you want to embed it into a website or a blog!

#ifndef HashTable_hpp
#define HashTable_hpp

#include <stdio.h>
#include <iostream>
#include "Utils.hpp"
using namespace std;
struct ZippedBookNode {
    // Book's title
    std::string title;
    // Book's body compressed and encoded in 0s and 1s according to Huffman encoding
    string c_excerpt;
    // Root of the huffman tree. Note that this is a HuffNode!
    // Where is the HuffNode decleared?
     //in utils.hpp
    // How can we access it? (look at the top of the file)
  // by using huffNode* xyz
    HuffNode* huff_root;
    // Pointer to the next node.
    // Why do we need this?-> to store value in hash table as linked list if it has same hashsum
    // What should it be initialized to?-> NULL
    ZippedBookNode* next;
    
    ZippedBookNode()
    {
        
    }
    
    ZippedBookNode(std::string name, string e, HuffNode* hr, ZippedBookNode* n)
    {
        title=name;
        c_excerpt=e;
        huff_root=hr;
        next=n;
        
    }
};


template <int ARRAY_LEN>
class HashTable {
    
public:

    HashTable();
    
    ~HashTable();
    
    int getTableSize();
    int hashSum(std::string bookTitle);

    void insertNode(ZippedBookNode* node);
    
    void printTitles();
    ZippedBookNode* lookupTable[ARRAY_LEN];
    
private:
    
    int tableSize;
};



#endif /* HashTable_hpp */

Create a free my code stock.com account now.

my code stok.com is a free service, which allows you to save and manage code snippes of any kind and programming language. We provide many advantages for your daily work with code-snippets, also for your teamwork. Give it a try!

Find out more and register now

You can customize the height of iFrame-Codes as needed! You can find more infos in our API Reference for iframe Embeds.