Trung Nguyen
/
FINAL_PROJECT_4180
asdasdasd
Fork of FINAL_PROJECT_4180 by
Diff: lib.cpp
- Revision:
- 10:c3556e27e576
- Parent:
- 9:48e93bcd1d5c
- Child:
- 11:1d7021c0739d
--- a/lib.cpp Mon Apr 25 01:39:32 2016 +0000 +++ b/lib.cpp Mon Apr 25 01:57:10 2016 +0000 @@ -202,3 +202,20 @@ } return val; } + +void add_to_table(HASH_RECORD *table, int ind, int user_id, int hash) +{ + HASH_RECORD rec = {user_id, hash}; + table[ind] = rec; +} + +bool contain_hash(HASH_RECORD *table, int table_size, int user_id, int hash) +{ + for (int i = 0; i < table_size; i++) { + HASH_RECORD h = table[i]; + if (h.user_id == user_id && h.hash == hash) { + return false; + } + } + return false; +}