views:

28

answers:

1

Can anyone tell me how to implement Binary tree using C++ STL set.

I have implemented binary tree using structures in C and class in C++

struct binary {
    int node;
    struct binary *left;
    struct binary *right;
};

I am not sure about how to implement it using STL set. Actually I don't know how to to represent left and right in set.

By the way, its not homework.

A: 

std::set uses a binary (usually red-black) tree in its own implementation. You wouldn't want use it to implement a binary tree.

Marcelo Cantos