|
Prev: finding the default gui manager
Next: Discount Price !! Richmond D&G Shoes, Chanel Bape Belts , Jimmy Choo Handbags, etc
From: Vandana on 29 Jun 2008 19:00 Hello All, I would like to implement a tree with the following properties. 1. The tree is balanced. 2. Each node has a max of 5 sub nodes and min of ceil(5/2) sub nodes. 3. The tree remains static. Number of nodes known from the beginning. What is the data structure that I can use to implement this? Thanks, Vandana.
From: CBFalconer on 29 Jun 2008 21:14 Vandana wrote: > > I would like to implement a tree with the following properties. > > 1. The tree is balanced. > 2. Each node has a max of 5 sub nodes and min of ceil(5/2) sub nodes. > 3. The tree remains static. Number of nodes known from the beginning. > > What is the data structure that I can use to implement this? A struct. -- [mail]: Chuck F (cbfalconer at maineline dot net) [page]: <http://cbfalconer.home.att.net> Try the download section.
From: Willem on 30 Jun 2008 05:18 Vandana wrote: ) Hello All, ) ) I would like to implement a tree with the following properties. ) ) 1. The tree is balanced. ) 2. Each node has a max of 5 sub nodes and min of ceil(5/2) sub nodes. ) 3. The tree remains static. Number of nodes known from the beginning. ) ) What is the data structure that I can use to implement this? If it really is static, make it an array. Each node will have exactly 5 sub nodes except for the very last one. Finding sub nodes involves a simple calculation in the array index: subnode(i) = i*5 + 5 + subnode SaSW, Willem -- Disclaimer: I am in no way responsible for any of the statements made in the above text. For all I know I might be drugged or something.. No I'm not paranoid. You all think I'm paranoid, don't you ! #EOT
From: Christian Gollwitzer on 30 Jun 2008 05:21 CBFalconer schrieb: > Vandana wrote: >> I would like to implement a tree with the following properties. >> >> 1. The tree is balanced. >> 2. Each node has a max of 5 sub nodes and min of ceil(5/2) sub nodes. >> 3. The tree remains static. Number of nodes known from the beginning. >> >> What is the data structure that I can use to implement this? > > A struct. > ??? Is this supposed to be a joke? Never heard of a data structure called "struct". 1. & 2. sound like B-tree, I don't understand requirement 3. Christian
From: pete on 30 Jun 2008 06:03
Christian Gollwitzer wrote: > CBFalconer schrieb: >> Vandana wrote: >>> I would like to implement a tree with the following properties. >>> >>> 1. The tree is balanced. >>> 2. Each node has a max of 5 sub nodes and min of ceil(5/2) sub nodes. >>> 3. The tree remains static. Number of nodes known from the beginning. >>> >>> What is the data structure that I can use to implement this? >> >> A struct. >> > ??? Is this supposed to be a joke? My first guess, is that it is supposed to be. > Never heard of a data structure > called "struct". It's a keyword in C. > 1. & 2. sound like B-tree, I don't understand requirement 3. I think that means that it doesn't have to be dynamically allocated. Every once in a while I see somebody post code, or stories, about a linked list where all of the nodes are located in an array of nodes. I've never been able to remember the explanation of why somebody would write code like that. -- pete |