●关联容器(也是ADT 抽象数据类型)
map,set,multiset,multimap
●有序容器
vector,list
1.std::map底层的数据结构为平衡二叉树(红黑树)进行实现。
2.二叉搜索树结构(代码)
class Node:
def __init__(self, data,color,parent):
self.left = None
self.right = None
self.data = data
self.parent = parent
self.color = color
class Tree:
def __init__(self,compare):
self.root = None
self.node_count = 0
self.key_compare = compare
●遍历抽象化
def visit(node, func):
if node:
printTree(node.left)
func(node.data)
printTree(node.right)
最后
以上就是害羞香菇最近收集整理的关于C++之map的数据结构表示的全部内容,更多相关C++之map内容请搜索靠谱客的其他文章。
本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
发表评论 取消回复