Solved

Implementing a tree in C++/Linux

Posted on 2010-09-10
6
590 Views
Last Modified: 2012-05-10
Hello,

I'm trying to implement a generic tree structure in a C++ Linux project.  There doesn't seem to be any standard tree container in C++, though.

Does such a container exist?

Thanks,
Tim
0
Comment
Question by:tmitch68
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
6 Comments
 
LVL 3

Expert Comment

by:packratt_jk
ID: 33648258
Not in standard c++, no.
0
 

Expert Comment

by:shaz_moony
ID: 33648259
yes
0
 

Author Comment

by:tmitch68
ID: 33648282
Can you tell me what it is?
0
Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

 
LVL 3

Assisted Solution

by:packratt_jk
packratt_jk earned 100 total points
ID: 33648293
There might be something in the STL - here's a tutorial for a linked list:

http://www.yolinux.com/TUTORIALS/LinuxTutorialC++STL.html

0
 
LVL 86

Accepted Solution

by:
jkr earned 200 total points
ID: 33648777
Maybe http://tree.phi-sci.com/ ("tree.hh: an STL-like C++ tree class") can help you.
0
 
LVL 32

Assisted Solution

by:phoffric
phoffric earned 200 total points
ID: 33649476
I always thought that an STL map would be implemented by a tree. (They even teach it that way in C++ courses when you have to design your own map.)

Here is one quote from a search to support this view:

"While the C++ standard does not specifically require that the map container be implemented using any specific data structure, the time complexity requirements imposed by the standard for each map operation suggest a balanced binary search tree. Many STL implementations use a red/black tree to implement map. Map operations such as searching for an element or adding an element are O(log n) operations. Logarithmic time complexity for these common operations means that maps are suitable for storing a collection of almost any size, including large collections. Also, map provides bidirectional iterators."

http://frank.mtsu.edu/~csjudy/STL/Map.html
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article shows you how to optimize memory allocations in C++ using placement new. Applicable especially to usecases dealing with creation of large number of objects. A brief on problem: Lets take example problem for simplicity: - I have a G…
The purpose of this article is to demonstrate how we can use conditional statements using Python.
Learn how to get help with Linux/Unix bash shell commands. Use help to read help documents for built in bash shell commands.: Use man to interface with the online reference manuals for shell commands.: Use man to search man pages for unknown command…
The viewer will be introduced to the technique of using vectors in C++. The video will cover how to define a vector, store values in the vector and retrieve data from the values stored in the vector.

726 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question