472,364 Members | 1,870 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,364 software developers and data experts.

How to store data - binary tree?

Hi

I would like to ask you a question.

Ian creating app. that download from server directory structure ( whole
tree ) and those data are placed in proper places into my treeview control.
I decided that the most effective way would be : When i connect to the
server once, I download the list and disconnect, instead of connecting every
time i go, to the lower node in my tree hierarhy.
Thus i have a problem - how to store data.
On the C++ i once created binary tree - i tought it might be good idea.
But when i googleed, i found an interesting for me note:
"In most cases binary trees can be replaced by use of one of the .NET
Framework container classes."

Can you tell me few words about this?
Do you think that in my case i should use container class, binary tree or
you have better idea.

Thanks
PK
Jan 26 '06 #1
3 4258
You're right to look for an alternative to writing your own binary tree
system, though there are some you could buy for .Net. Writing a very basic
one is not exactly trivial but then it is not terribly difficult either.

As an alternative, you could use something like a Hashtable or ArrayList to
store your structure, with each succeeding level being stored as another
Hashtable or ArrayList stored as an element of the first collection. But I
wouldn't. Keeping track of your levels of objects and the parent objects,
etc. can be as difficult as writing a simple binary tree.

Another option is to create a custom collection extending CollectionBase and
add a property to your custom collection that is another instance of its own
type. But, again, you'd have to code your own navigation implementation.

I suggest that you create an XmlDocument in memory and build your tree
there. XML is great for storing data in tree-like structures.
--
Dale Preston
MCAD C#
MCSE, MCDBA
"piotrek" wrote:
Hi

I would like to ask you a question.

Ian creating app. that download from server directory structure ( whole
tree ) and those data are placed in proper places into my treeview control.
I decided that the most effective way would be : When i connect to the
server once, I download the list and disconnect, instead of connecting every
time i go, to the lower node in my tree hierarhy.
Thus i have a problem - how to store data.
On the C++ i once created binary tree - i tought it might be good idea.
But when i googleed, i found an interesting for me note:
"In most cases binary trees can be replaced by use of one of the .NET
Framework container classes."

Can you tell me few words about this?
Do you think that in my case i should use container class, binary tree or
you have better idea.

Thanks
PK

Jan 27 '06 #2
Thank you.

I have been thinking about XML, but i seetled that file operations will be
slower than in-memory operations.
Anyway i try with XML.
Jan 27 '06 #3
You can do XML completely in memory.

The benefit is that all the tools are there to navigate and search your tree
structured data. The negative is that there all that functionality comes at
a price. If your set of data is very small it may not be worth the overhead.
If your set of data is very large, it may not be efficient. For what comes
in between, it may be just the ticket.
--
Dale Preston
MCAD C#
MCSE, MCDBA
"piotrek" wrote:
Thank you.

I have been thinking about XML, but i seetled that file operations will be
slower than in-memory operations.
Anyway i try with XML.

Jan 27 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
by: pembed2003 | last post by:
Hi, I have a question about how to walk a binary tree. Suppose that I have this binary tree: 8 / \ 5 16 / \ / \ 3 7 9 22 / \ / \ / \
5
by: pembed2003 | last post by:
Hi, I have a question about how to walk a binary tree. Suppose that I have this binary tree: 8 / \ 5 16 / \ / \ 3 7 9 22 / \ / \ / \
0
by: Bonj | last post by:
hello this is a purely algorithmical question but if i have posted to an irrelevant group, apologies. can anyone point me at some good tutorials or info about the steps involved in creating a...
4
by: Ken | last post by:
I have a binary tree in VB NET and insertions seem to be slow. The program receives data from one source and inserts it into the tree. The program receives data from another source and...
9
by: GiantCranesInDublin | last post by:
Hi, I am looking for the best performing solution for modifying and iterating an object graph in JavaScript. I have outlined below a simplified example of the object model and examples of how I...
1
by: Andrew | last post by:
Hi, im trying to create a small function which can create a binary tree from the entries in a text file and after that we can perform all the usual operations like search, insert and delete etc....
20
by: DemonFox | last post by:
i have started my midterm exersize than is on binary treescan anyone help me on the basics i have started and i have made the following on my tree.h file: struct treenode { int data;...
8
by: csharpula csharp | last post by:
Hello friends, I would like to know what is the best way to store a tree structure in c#? Are there any good implementation examples for seing how to do it? Thank u! *** Sent via...
0
by: Naresh1 | last post by:
What is WebLogic Admin Training? WebLogic Admin Training is a specialized program designed to equip individuals with the skills and knowledge required to effectively administer and manage Oracle...
0
by: antdb | last post by:
Ⅰ. Advantage of AntDB: hyper-convergence + streaming processing engine In the overall architecture, a new "hyper-convergence" concept was proposed, which integrated multiple engines and...
0
by: AndyPSV | last post by:
HOW CAN I CREATE AN AI with an .executable file that would suck all files in the folder and on my computerHOW CAN I CREATE AN AI with an .executable file that would suck all files in the folder and...
0
by: Carina712 | last post by:
Setting background colors for Excel documents can help to improve the visual appeal of the document and make it easier to read and understand. Background colors can be used to highlight important...
0
BLUEPANDA
by: BLUEPANDA | last post by:
At BluePanda Dev, we're passionate about building high-quality software and sharing our knowledge with the community. That's why we've created a SaaS starter kit that's not only easy to use but also...
0
by: Rahul1995seven | last post by:
Introduction: In the realm of programming languages, Python has emerged as a powerhouse. With its simplicity, versatility, and robustness, Python has gained popularity among beginners and experts...
2
by: Ricardo de Mila | last post by:
Dear people, good afternoon... I have a form in msAccess with lots of controls and a specific routine must be triggered if the mouse_down event happens in any control. Than I need to discover what...
1
by: Johno34 | last post by:
I have this click event on my form. It speaks to a Datasheet Subform Private Sub Command260_Click() Dim r As DAO.Recordset Set r = Form_frmABCD.Form.RecordsetClone r.MoveFirst Do If...
1
by: ezappsrUS | last post by:
Hi, I wonder if someone knows where I am going wrong below. I have a continuous form and two labels where only one would be visible depending on the checkbox being checked or not. Below is the...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.