[英]Is there a way to access single nodes from multiset tree faster than O(n)(using iterator and counting iterations in loop)? [on hold]
I've tried a lot of things to do it, but unsuccessful:( Maybe it'll be better if I write binary searching tree with some extra options myself? I have to keep elements in sorted order, to change single element and to get single element "by index".我已经尝试了很多事情,但没有成功:(如果我自己编写带有一些额外选项的二叉搜索树可能会更好?我必须保持元素排序,更改单个元素并获取单个元素“按索引”。
The std::multiset is fine. std::multiset 很好。 The find() function should have O(logn) with a worst case of O(n), as the std::multiset is implemented as a BST.
find() function 应该有 O(logn),最坏的情况是 O(n),因为 std::multiset 是作为 BST 实现的。 Are you using the std namespace?
你在使用 std 命名空间吗?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.