Solved

Implementing a tree in C++/Linux

Posted on 2010-09-10
6
583 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
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
Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

 
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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Suggested Solutions

Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
Join Greg Farro and Ethan Banks from Packet Pushers (http://packetpushers.net/podcast/podcasts/pq-show-93-smart-network-monitoring-paessler-sponsored/) and Greg Ross from Paessler (https://www.paessler.com/prtg) for a discussion about smart network …
The goal of the tutorial is to teach the user how to use functions in C++. The video will cover how to define functions, how to call functions and how to create functions prototypes. Microsoft Visual C++ 2010 Express will be used as a text editor an…
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.

758 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

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now