unordered_multimap max_load_factor() function in C++The unordered_multimap::load_factor() function is a C++ STL built-in function that returns the current value of the load factor in the unordered_multimap container. The load factor is defined as the ratio of the total amount of components in a container (its size) to the total number of buckets (bucket_count): load_factor = bucket_count / size The load factor impacts the probability of a collision inside a hash table (i.e., the probability of two entries being in the same bucket). By inducing a rehash each time an expansion is required, the container dynamically raises the number of buckets to maintain the load factor below a certain threshold (its max_load_factor). The unordered_multimap::max_load_factor() function is a standard C++ STL function that produces the maximum load factor of the unordered_multimap containers. This function also allows you to specify the maximum load factor. Syntax:It has the following function: Functions: The function accepts no parameters. Return Value: It provides an integral value indicating the container's maximum load factor. Example:Output: The max load factor value is: 1 The key values of ex are:{6, 600} {5, 500} Syntax:The function receives a single necessary parameter, N, that indicates the load factor to be set. This N represents the container's maximum load factor. Return Value: Nothing is returned by the function Example:Output: The value of the load balancer: 1 The max load factor of the sample after setting it: 300 The elements of the sample {40, 400} {10, 300} Next TopicUse of explicit keyword in C++ |
We provides tutorials and interview questions of all technology like java tutorial, android, java frameworks
G-13, 2nd Floor, Sec-3, Noida, UP, 201301, India