473,748 Members | 5,849 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 4439
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
3651
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
9572
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
2018
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 high-end generic binary tree (or, ternary search tree). The basic method I've got at the moment is having a resource file containing a series of data structures (which represent strings), specifically organised such that a test string can be matched...
4
2949
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 looks the data up in the tree.
9
6304
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 will be using this graph. Object model:
1
4395
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. Now i have entries something like this IPaddress Phone No 192.168.2.1 2223447689 192.168.2.2 3334449898 192.168.2.3 5667869089
20
2401
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; struct treenode *left; struct treenode *right;
8
5073
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 Developersdex http://www.developersdex.com ***
0
9363
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9312
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9238
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6793
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6073
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4593
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4864
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3300
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2206
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.