1

I'm currently exploring std::set and std::multiset. I know that they are binary trees, But I was wondering if its possible to access the sub tree of a node which is sorted in set or multiset. For example, suppose that I have inserted (1,3,6,4,7,8,10,14,13) in a set and it looks like this:

enter image description here

Is it possible to find the sub tree of 3 which is 3,1,4,6,7?

MoNo
  • 307
  • 4
  • 15

1 Answers1

2

No, it's not possible - the Standard Library doesn't specify any functions in the std::set or std::multiset APIs that give any indication of the internal node layout.

Tony Delroy
  • 102,968
  • 15
  • 177
  • 252
  • I'm trying to implement a 2d-Range tree, And I was wondering if I could use `std::set`instead of implementing a balanced binary tree from scratch, cause I think its more efficient to use the standard library tools. Is this possible? – MoNo May 22 '15 at 04:33
  • @MoNo: I'm not sure... I know next to nothing about 2d-Range trees - not enough to guess at an implementation approach. You're not the first to [ask about it on S.O.](http://stackoverflow.com/questions/15663914/implement-2d-range-tree-c) - there's mention of a (slow) implementation in comments. – Tony Delroy May 22 '15 at 04:39