hashset usage
- HashSet can have null, order is not guaranteed
- HashSet is commonly used if you want to access elements randomly or store a list of items which cannot contain duplicate values
hashset usage
- HashSet can have null, order is not guaranteed
- HashSet is commonly used if you want to access elements randomly or store a list of items which cannot contain duplicate values
hashset implementation
class MyHashSet {
private:
vector<bool> table;
public:
MyHashSet() : table(1e6 + 1, false) {}
void add(int key) {
table[key] = true;
}
void remove(int key) {
table[key] = false;
}
bool contains(int key) {
return table[key];
}
};
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us