Trees

R

Roman Töngi

Are there classes for Trees?
Such as binary trees and binary search trees.

Thx.
 
V

Victor Bazarov

Roman said:
Are there classes for Trees?
Such as binary trees and binary search trees.

I am sure there is plenty. Have you looked or did you
just decide to ask here first?

V
 
O

osmium

Roman Töngi said:
Are there classes for Trees?
Such as binary trees and binary search trees.

Look at the stuff in <map>. Also see bsearch() in <cstdlib>

_The C++ Standard Library_ by Nicolai Josuttis is invaluable for a serious
C++ programmer. It is useful for both learning and then later as a reference
manual.
 
R

Roman Töngi

I am a beginner. I looked for trees, I didn't
know that one has to implement them on one's own
using maps.
 
R

Roman Töngi

Thx

Do I have to implement trees on my own using maps if
only the STL is regarded?
 
O

osmium

Roman Töngi said:
Do I have to implement trees on my own using maps if
only the STL is regarded?

Map is the word used in C++ for a tree. Plug this into google
<map tree associative c++>
 
E

Erik Wikström

Map is the word used in C++ for a tree. Plug this into google
<map tree associative c++>

Actually no, a map is a data-structure that maps a key top a value. It
is however true that std::map is (usually) implemented using a
(red-black) tree, but so is std::set. So what the OP needs to clarify is
whether he needs a tree data structure or a container based on a tree
data structure. If it is the latter then std::map or std::set will
probably do fine.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Members online

Forum statistics

Threads
473,756
Messages
2,569,540
Members
45,025
Latest member
KetoRushACVFitness

Latest Threads

Top