load_factor(): This function is available in the File: unordered_set.h. This function is a build-in function in STL of C++ which returns the average number of elements per bucket.
Syntax:
float std::unordered_set<int>::load_factor() const
This function returns the average number of elements per bucket.
Parameters: NA
File: unordered_set.h
Approach
C++
#include <bits/stdc++.h>using namespace std;int main(){unordered_set<int> st = {1, 2, 3, 4, 5, 6, 89, 12};cout << st.load_factor() << "\n";return 0;}
Output:
0.727273
No comments:
Post a Comment