The
unordered_multiset::bucket() is a built-in function in C++ STL which returns the bucket number in which a given element is. Bucket size varies from 0 to
bucket_count-1.
Syntax:
unordered_multiset_name.bucket(element)
Parameters: The function accepts a single mandatory
element which specifies the value whose bucket number is to be returned.
Return Value: It returns an unsigned integral type which signifies the bucket number in which the element is.
Below programs illustrates the above function:
Program 1:
Output:
The bucket number in which 13 is 6
The bucket number in which 13 is 6
The bucket number in which 10 is 3
The bucket number in which 15 is 1
The bucket number in which 15 is 1
Program 2: