-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathHashFirst.cpp
37 lines (30 loc) · 829 Bytes
/
HashFirst.cpp
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
34
35
36
//
// HashFirst.cpp
// DNASequenceAlignment
//
// Created by Zihan Qu on 6/24/21.
// Copyright © 2021 Zihan Qu. All rights reserved.
//
#include <stdio.h>
#include "Set.hpp"
using namespace std;
HashFirst::HashFirst(unsigned int b) {
this->tableBUCKET = b;
table = new list<positionPlusSixKmer*>[tableBUCKET];
}
HashFirst::~HashFirst() {
for (unsigned int i = 0; i < this->tableBUCKET; i += 1) {
for (auto content : this->table[i]) {
delete content;
}
}
}
void HashFirst::insertItem(std::string insertedElement, positionPlusSixKmer *obj) {
//cout << insertedElement << endl;
unsigned int index = hashFunction(insertedElement);
table[index].push_back(obj);
this->firstSize += 1;
}
unsigned int HashFirst::getTableSize() {
return this->firstSize;
}