bucket_size(): This function is available in the File: unordered_set.h
Syntax:
std::size_t std::unordered_set<int>::bucket_size(std::size_t __n) const
This function takes an argument of type size_t as its parameter. This function returns the number of elements in a given bucket.
Parameters: One parameter is required for this function.
__n – A bucket index.
Returns: The number of elements in the bucket.
File: unordered_set.h
For Example:
st = {9,4}
st.bucket_size() = > It returns 0.
Approach
C++
#include <bits/stdc++.h>using namespace std;int main(){unordered_set<int> st;st.insert(9);st.insert(4);int n = 2;cout << st.bucket_size(n) << "\n";return 0;}
Output:
0
No comments:
Post a Comment