Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions 03-hashing/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ hash = 5
Changing the value of `a` give us a different hash function.

```
hash("cat", 163, 53) = 3
hash("cat", 163, 53) = 21
```

## Implementation
Expand All @@ -65,8 +65,8 @@ static int ht_hash(const char* s, const int a, const int m) {
const int len_s = strlen(s);
for (int i = 0; i < len_s; i++) {
hash += (long)pow(a, len_s - (i+1)) * s[i];
hash = hash % m;
}
hash = hash % m;
return (int)hash;
}
```
Expand Down