Create |
Empty |
unordered_set<string> us;
|
set of pairs |
using mpair = pair<double, double>;
struct Hash {
size_t operator()(const mpair& p) const {
return hash<double>()(p.first) ^ hash<double>()(p.second);
}
};
unordered_set<mpair, Hash> us(s.begin(), s.end());
|
Filled from String |
string s = "abcda";
unordered_set<char> us(s.begin(), s.end());
|
n sets |
unordered_set<string> us(n);
|
|
Empty |
let mut hs:HashSet<String> = HashSet::new();
|
Filled From String |
let s = String::from("abcda");
let mut us:HashSet<char> = s.chars().collect();
|
|
Empty |
hs = set()
|
Filled |
//Copy words from vector
word: List[str]
hs = set(words)
# n sets
graph = [set() for _ in range(n)]
|
|
Find |
value = us[key]
value=count(key)
|
if let Some(value) = hs.get(&key) {
//value returned
} else {
// Not found
}
|
if key in hs:
// contains key
|