std :: map中find()的时间复杂度? [英] Time complexity of find() in std::map?
本文介绍了std :: map中find()的时间复杂度?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
std :: map类的find()函数的效率如何?它是否遍历所有寻找密钥的元素,使它是O(n),或者是在一个平衡的树中,还是使用哈希函数或什么?
How efficient is the find() function on the std::map class? Does it iterate through all the elements looking for the key such that it's O(n), or is it in a balanced tree, or does it use a hash function or what?
推荐答案
日志(n)它基于一个红黑树。
编辑:n当然是地图中的成员数量。
n is of course the number of members in the map.
这篇关于std :: map中find()的时间复杂度?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文