473,765 Members | 2,047 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 1346
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**********@t con-NOSPAM.co.il> wrote in message
news:%2******** *******@TK2MSFT NGP12.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**********@t con-NOSPAM.co.il> wrote in message
news:%2******** *******@TK2MSFT NGP12.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**********@t con-NOSPAM.co.il> wrote in message
news:eC******** *****@tk2msftng p13.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**********@t con-NOSPAM.co.il> wrote in message
news:%2******** *******@TK2MSFT NGP12.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********@tel hai.ac.il> wrote in message
news:%2******** ********@TK2MSF TNGP14.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**********@t con-NOSPAM.co.il> wrote in message
news:eC******** *****@tk2msftng p13.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**********@t con-NOSPAM.co.il> wrote in message
news:%2******** *******@TK2MSFT NGP12.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******** ******@tk2msftn gp13.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
3474
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 Pentagjetvedeh karuvificials madhla reachathe strategy in karkun campaign deshatinst terrorism. "mudivae maretu winning or losing karkun global varti jetvedeh terror?" Mr. Rumsfeld adugued in a recent memormariyuum. vede velli jetvedeh madhla...
9
3137
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 SUBSTRING(ProductName, 1, CHARINDEX('(', ProductName)-2). I can get this result, but I had to use several views (totally inefficient). I think this can be done in one efficient/fast query, but I can't think of one. In the case that one query is not...
14
4633
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 eBay, Yahoo and others. This is what she wants my program to be able to do: (try this test at different websites just for fun). At eBay: - enter the word 'television' in a search field à you will get 2155 items.
25
7593
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() might take linear time on some list implementations. That makes sense at first. However, he also says this at the very beginning: "That being the case , you might wonder why one construct should be preferred to the other, especially in view of the...
10
3483
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: Prices Fields: Inventory #, Price, Effective Year, Effective Month, Effective Day
8
1605
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 value) from map<string, stringsource to dest - without overwriting any entries in dest unless the keys match, ie: for (map<string, string>::const_iterator p = source.begin(); p != source.end(); ++p)
45
4297
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 number of cents required, find the correct and most effective combination of stamps. meaning that if you were to need 14cents, the correct output should be 2 seven cents not 7 two cents.
23
2528
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) return s def descrambleLine(line):
0
9568
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9404
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10164
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10007
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
9959
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
9835
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
7379
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
6649
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
5277
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...

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.