Trees

Discussion in 'C++' started by Roman Töngi, Nov 20, 2007.

  1. Roman Töngi

    Roman Töngi Guest

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

    Thx.
    Roman Töngi, Nov 20, 2007
    #1
    1. Advertising

  2. Roman Töngi wrote:
    > 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
    --
    Please remove capital 'A's when replying by e-mail
    I do not respond to top-posted replies, please don't ask
    Victor Bazarov, Nov 20, 2007
    #2
    1. Advertising

  3. Roman Töngi

    osmium Guest

    "Roman Töngi" writes:

    > 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.
    osmium, Nov 20, 2007
    #3
  4. Roman Töngi

    Roman Töngi Guest

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

    Victor Bazarov wrote:
    > Roman Töngi wrote:
    >> 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
    Roman Töngi, Nov 20, 2007
    #4
  5. Roman Töngi

    Roman Töngi Guest

    Thx

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


    osmium wrote:
    > "Roman Töngi" writes:
    >
    >> 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.
    >
    >
    Roman Töngi, Nov 20, 2007
    #5
  6. Roman Töngi

    osmium Guest

    "Roman Töngi" writes:

    > 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++>
    osmium, Nov 20, 2007
    #6
  7. On 2007-11-20 16:55, osmium wrote:
    > "Roman T霵gi" writes:
    >
    >> 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++>


    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.

    --
    Erik Wikström
    Erik Wikström, Nov 20, 2007
    #7
  8. Roman Töngi

    mathieu Guest

    On 20 nov, 14:22, Roman Töngi <> wrote:
    > Are there classes for Trees?
    > Such as binary trees and binary search trees.



    At some point I was also looking for such structure. But AFAIK they
    are not exposed even though they are obvisouly used for std::set o
    std::map.
    A very stl'ish implementation can be found here:

    http://www.aei.mpg.de/~peekas/tree/

    HTH
    -Mathieu
    mathieu, Nov 20, 2007
    #8
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Pif

    Trees in java

    Pif, Apr 6, 2004, in forum: Java
    Replies:
    1
    Views:
    427
    Manolo
    Apr 6, 2004
  2. jova

    Binary Trees

    jova, Apr 25, 2004, in forum: Java
    Replies:
    11
    Views:
    719
    Roedy Green
    Apr 26, 2004
  3. Joona I Palaste

    Trees in the Java Collections framework

    Joona I Palaste, Jun 8, 2004, in forum: Java
    Replies:
    5
    Views:
    541
    Chris Uppal
    Jun 9, 2004
  4. Rico

    B+-trees

    Rico, Jul 29, 2004, in forum: Java
    Replies:
    10
    Views:
    1,706
    Eric Sosman
    Aug 2, 2004
  5. jacob navia

    Binary search trees (AVL trees)

    jacob navia, Jan 3, 2010, in forum: C Programming
    Replies:
    34
    Views:
    1,385
    Dann Corbit
    Jan 8, 2010
Loading...

Share This Page