unordered_set load_factor() in C++

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<intst = {1234568912};

    cout << st.load_factor() << "\n";
    return 0;
}

Output:

0.727273

No comments:

Post a Comment