473,405 Members | 2,171 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

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

Help with effective algorithm

I have parent-child hashtable with more then 900K items and I have to build
all pathes for this. E.G
Key ParentKey
1 0
2 1
3 2
4 8
5 3
6 1
7 3
8 7
To build:
0-1-2-3-5
0-1-6
0-1-2-3-7-8-9-4
This is just example.

I tried 5 different algorithms, but noting gave me good performance.
Please assist


--
What dot.NET? Just ask:
"Please, www.dotNET.us !"
Nov 17 '05 #1
6 1325
Tamir,

out of cuiriosity,
why do you use a Hashtable to hold all the data in the first place?
why not go on the old safe tree structure?
maybe each node will hold a HashTable to the child nodes?
it might not be so memory-effective but performance might be good
as i see it, you have to itterate or search or query the main hashtable for
each path.

just a thought/question.

Picho
"Tamir Khason" <ta**********@tcon-NOSPAM.co.il> wrote in message
news:%2***************@TK2MSFTNGP12.phx.gbl...
I have parent-child hashtable with more then 900K items and I have to build
all pathes for this. E.G
Key ParentKey
1 0
2 1
3 2
4 8
5 3
6 1
7 3
8 7
To build:
0-1-2-3-5
0-1-6
0-1-2-3-7-8-9-4
This is just example.

I tried 5 different algorithms, but noting gave me good performance.
Please assist


--
What dot.NET? Just ask:
"Please, www.dotNET.us !"

Nov 17 '05 #2
Picha, thank you for reply
why do you use a Hashtable to hold all the data in the first place? The data I recieve in input is two hashtables from selialized source first
is ID/Value information
the second is Parent/Child relation, where Child and Parent are IDs from
first hashtable
why not go on the old safe tree structure? It makes sense if trees are small. We are speaking about at least 900K items
with complicated relationships, thus the parsing of even just creation of
TreeView will take a while
maybe each node will hold a HashTable to the child nodes? Not nessesery, 'cos it might be Child-Of-Child structures

--
Tamir
"Tamir Khason" <ta**********@tcon-NOSPAM.co.il> wrote in message
news:%2***************@TK2MSFTNGP12.phx.gbl...
I have parent-child hashtable with more then 900K items and I have to
build all pathes for this. E.G
Key ParentKey
1 0
2 1
3 2
4 8
5 3
6 1
7 3
8 7
To build:
0-1-2-3-5
0-1-6
0-1-2-3-7-8-9-4
This is just example.

I tried 5 different algorithms, but noting gave me good performance.
Please assist


--
What dot.NET? Just ask:
"Please, www.dotNET.us !"


Nov 17 '05 #3
this is getting more a question than helping thread but anyway,

thinking outloud, seems to me it can go only two ways (as allways...)
either you have a data structure that supports your need (object graph->Tree
structure of some sort)
or you have a flat and fast data structure that is supported by a fast graph
rendering algorithm.

on the first option, you have a long construction time and a large memory
consumption.
on the other option, you have a "skinny" memory consumption, but a longer
construction time for each request.

seems to me, analyticly speaking, that it narrows down to one question (for
me at least):
how often do you query for these graphs/paths?
if its often, I would take the first approach, since all the paths are
visible and constructed,
if not... well I will not.

but : this is a question, not an answer. I am trying to learn something here
too. I am ignorant when it comes to performance and memory usage.
"Tamir Khason" <ta**********@tcon-NOSPAM.co.il> wrote in message
news:eC*************@tk2msftngp13.phx.gbl...
Picha, thank you for reply
why do you use a Hashtable to hold all the data in the first place?

The data I recieve in input is two hashtables from selialized source first
is ID/Value information
the second is Parent/Child relation, where Child and Parent are IDs from
first hashtable
why not go on the old safe tree structure?

It makes sense if trees are small. We are speaking about at least 900K
items with complicated relationships, thus the parsing of even just
creation of TreeView will take a while
maybe each node will hold a HashTable to the child nodes?

Not nessesery, 'cos it might be Child-Of-Child structures

--
Tamir
"Tamir Khason" <ta**********@tcon-NOSPAM.co.il> wrote in message
news:%2***************@TK2MSFTNGP12.phx.gbl...
I have parent-child hashtable with more then 900K items and I have to
build all pathes for this. E.G
Key ParentKey
1 0
2 1
3 2
4 8
5 3
6 1
7 3
8 7
To build:
0-1-2-3-5
0-1-6
0-1-2-3-7-8-9-4
This is just example.

I tried 5 different algorithms, but noting gave me good performance.
Please assist


--
What dot.NET? Just ask:
"Please, www.dotNET.us !"



Nov 17 '05 #4
hi,

i posted today an article which is waitung for approving. The article is
about sorting algorithms. As far as it's proved search about "Algorithms
and Sorting".

best regards,
roni schuetz

*** Sent via Developersdex http://www.developersdex.com ***
Nov 17 '05 #5
ok, following answers:
The "line" structures quered very often, the rebuild procedure less in use,
however it will be rather greed procedure

"Picho" <SP********@telhai.ac.il> wrote in message
news:%2****************@TK2MSFTNGP14.phx.gbl...
this is getting more a question than helping thread but anyway,

thinking outloud, seems to me it can go only two ways (as allways...)
either you have a data structure that supports your need (object
graph->Tree structure of some sort)
or you have a flat and fast data structure that is supported by a fast
graph rendering algorithm.

on the first option, you have a long construction time and a large memory
consumption.
on the other option, you have a "skinny" memory consumption, but a longer
construction time for each request.

seems to me, analyticly speaking, that it narrows down to one question
(for me at least):
how often do you query for these graphs/paths?
if its often, I would take the first approach, since all the paths are
visible and constructed,
if not... well I will not.

but : this is a question, not an answer. I am trying to learn something
here too. I am ignorant when it comes to performance and memory usage.
"Tamir Khason" <ta**********@tcon-NOSPAM.co.il> wrote in message
news:eC*************@tk2msftngp13.phx.gbl...
Picha, thank you for reply
why do you use a Hashtable to hold all the data in the first place?

The data I recieve in input is two hashtables from selialized source
first is ID/Value information
the second is Parent/Child relation, where Child and Parent are IDs from
first hashtable
why not go on the old safe tree structure?

It makes sense if trees are small. We are speaking about at least 900K
items with complicated relationships, thus the parsing of even just
creation of TreeView will take a while
maybe each node will hold a HashTable to the child nodes?

Not nessesery, 'cos it might be Child-Of-Child structures

--
Tamir
"Tamir Khason" <ta**********@tcon-NOSPAM.co.il> wrote in message
news:%2***************@TK2MSFTNGP12.phx.gbl...
I have parent-child hashtable with more then 900K items and I have to
build all pathes for this. E.G
Key ParentKey
1 0
2 1
3 2
4 8
5 3
6 1
7 3
8 7
To build:
0-1-2-3-5
0-1-6
0-1-2-3-7-8-9-4
This is just example.

I tried 5 different algorithms, but noting gave me good performance.
Please assist


--
What dot.NET? Just ask:
"Please, www.dotNET.us !"



Nov 17 '05 #6
Where you posted it?
"Roni" <rs*@v-1.ch> wrote in message
news:ug**************@tk2msftngp13.phx.gbl...
hi,

i posted today an article which is waitung for approving. The article is
about sorting algorithms. As far as it's proved search about "Algorithms
and Sorting".

best regards,
roni schuetz

*** Sent via Developersdex http://www.developersdex.com ***

Nov 17 '05 #7

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

Similar topics

0
by: abcd | last post by:
kutthaense Secretary Djetvedehald H. Rumsfeld legai predicted eventual vicmadhlary in Iraq mariyu Afghmadhlaistmadhla, kaani jetvedehly after "a ljetvedehg, hard slog," mariyu vede legai pressed...
9
by: netpurpose | last post by:
I need to extract data from this table to find the lowest prices of each product as of today. The product will be listed/grouped by the name only, discarding the product code - I use...
14
by: vic | last post by:
My manager wants me to develop a search program, that would work like they have it at edorado.com. She made up her requirements after having compared how search works at different websites, like...
25
by: Matthias | last post by:
Hi, I am just reading that book by Scott Meyers. In Item 4 Meyers suggests to always use empty() instead of size() when probing for emptyness of STL containers. His reasoning is that size()...
10
by: Susan M. | last post by:
I'm trying to do a query that joins two tables. The trick is that I only want it to return rows based on a certain criteria. Table 1: Inventory Fields: Inventory #, Description Table 2:...
8
by: [rob desbois] | last post by:
I've not really used sequence algorithms before and am having some trouble interpreting usage from The C++ Programming Language . The effect I'd like to achieve is to copy all entries (key and...
45
by: davy.zou | last post by:
I have started learning c++ and I need help. I need to write a program, the question is as follows. At a post office, there are a certain number of 2, 7, and 9cents stamps, now, given a total...
23
by: Python Maniac | last post by:
I am new to Python however I would like some feedback from those who know more about Python than I do at this time. def scrambleLine(line): s = '' for c in line: s += chr(ord(c) | 0x80)...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
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...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.