开发者

How to create binary tree using STL Set C++

开发者 https://www.devze.com 2023-01-22 07:28 出处:网络
Can anyone tell me how to implement Binary tree using C++ STL set. I have implemented binary t开发者_如何学Pythonree using structures in C and class in C++

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

I have implemented binary t开发者_如何学Pythonree 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.


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

0

精彩评论

暂无评论...
验证码 换一张
取 消