tree

Dotnet - flatten a tree (list of lists) with one statement?

Hi, Thanks to nHibernate, some of the data structures I work with are lists within lists within lists. So for example I have a data object called "category" which has a .Children property that resolves to a list of categories ... each one of which can have children ... and so on and so on. I need to find a way of starting at a top-leve...

extjs 3 - Stop combobox from collapsing when [+] in tree within combobox is clicked

hi everyone I have implemented tree within combobox using idea from this thread but when [+] or arrow on tree is clicked, the combobox collapses Is there any way to stop this???????? Please help me....Thanks alot....... Regards ...

Using "pathdir" on Java Applications

Hey guys, First, i'm using Ubuntu! :) I need some help here, I built a Java App, i want to set a default path tree, like this: > cd /anyDirectory/meuRestaurante > ls bin/ data/ > cd bin > ls meuRestaurante.jar > cd .. > cd data > ls Cartoes.txt Clientes.txt I want that my Java App save these txt's files on /data directory, while is o...

Copy binary tree in order

The code I wrote so far is: void copyInOrder(TNode *orgTree, Tnode *& copyTree){ if(orgTree !=NULL){ copyInOrder(orgTree->left_link); //create leftmost node of tree but how to link to parent copyInOrder(orgTree->right_link); } } I dont know how to link to the parent to the nodes as its inorder. ...

Binary Tree Depth Problem

I read a few other articles on here that looked similar, but didn't quite answer my problem. I've been given a question for an assignment to assign every node in a binary tree its respective depth. I just can't quite get it. For reference this is my code: struct treeNode { int item; int depth; treeNode *left; treeNode *right...

What are patterns/types of task queues? Can the multi-level task queue exist in form of a N-tree?

Hi, I still didn't discovered a widely accepted pattern for following situation: In the database, a three-level deep series of tasks exists. Main task: gather data for user X; report data; Sub-task: ensure that all data is fetched and is correct; report success or errors Minimal task: get a piece of data from network, match it agains...

What Tree structure should I use for indexing?

I'm thinking of experimenting with using a tree-structure for indexing as I want to test whether it is faster than my current indexing implementation which is in essence a hash based lookup. I've read up on various questions and articles about performance of B-Trees, AVL-Trees and Red-Black Trees and can't really see much difference bet...

flex tree custom item renderer children creation

Hi, I have created a custom item renderer for the tree, i have added some children in create children function, my problem is that sometimes i need to show these children and sometimes i don't, depending on clicking on a button which also i have added at create children, the problem is that i had to create the item even if i don't want ...

How to get vectors working in a created tree - root

Hi, This is a Root question, but I thought I'd try my luck in-case anyone has experience! I have created a piece of code that will filter out final particles from a sample into a new tree. I have succeeded in doing so by creating a tree with repeated fields ie. event number, but am trying to make it better for analysis by using vectors ...

In a tree data structure, is a node a sibling of itself?

I am building a tree like data structure. What is the expected behavior if I have a method public Set getSiblingNodes(Node node); Should this method return a set including or excluding itself? Thanks! ...

Binary Search Tree Height

I was asked to build a binary search tree after adding about 20 values in a specific order and I finished and found the size to be 16 and the height to be 4. But part (c) of the question asks me to find the Height (after removal) I am unsure what this means and would be grateful if somebody could clarify what this means. ...

flex tree itemclick event, doesn't work

Hello Stackoverflowers, i'm creating a reusable flex tree component. And i would like to stick in the itemclick funtion. So that when a user clicks anywhere on one of the tree's Branches. the branch expands. My problem is that i don't know how i can get the listener function to fire. What i would like to do is create the tree completely...

Create tree with ruby.

I want to create tree with ruby. Any link or code ? I have two tables. table1 fields id name desc table2 fields id table1_id table1_parent_id I want to fetch all the descendents for the specific object. I have 1 row of table1. t = Table1.first On the basis of object t I want to fetch all it's children and children of childre...

Proof by Induction of the sum of heights of nodes in a full binary tree

I'm trying to prove the following by induction: sum(k*2^(H-k), k = 0 .. H) = N-H-1 it's a problem for an algorithms class. I was thinking I could do what I normally do for summations, which is to assume that it works for some P(m) and then increment the sum for P(m+1) and work backwards by adding to the right side what the additional ...

Haskell programing: map and fold on search trees

I have a search tree thats defined as data (Ord a) => Stree a = Null | Fork(Stree a) a (Stree a) deriving Show and I have to define two functions, mapStree: mapStree :: (Ord b, Ord a) => (a -> b) -> Stree a -> Stree b and foldStree: foldStree :: (Ord a) => (b -> a -> b -> b) -> b -> Stree a -> b I dont fully understand whats g...

Fix depth tree in Python

I want to implement a tree structure which has fixed depth, i.e. when adding children to the leef nodes, the whole tree structure should "move up". This also means that several roots can exist simultaneously. See example beneath: In this example, the green nodes are added in iteration 1, deleting the top node (grey) and making the two b...

Rails 3 Tree Data Structure

I have bees searching for a good solution for Tree Data Structure in Rails 3. I'm trying to build a Tree menu. What do you use and what would you recommend? ...

Setting background-color for Flex Tree component..?

I have a Flex Tree component in my app. I set the icons for open and close. BUT I can't find something about changing the default background-color from white to something different. obviously there is no background-color setable in css... any ideas? thank you ...

Calculating the smallest possible tree

Given a set of nodes, how can I construct a tree which links together all the nodes in a way which minimises max(max(degree), max(depth))? For example, given a set of five nodes, I could connect them like so: However, this is not minimal, since max(degree) == 4 and max(depth) == 1, a better tree would be: which has max(degree) == ...

game search tree, Do I have to build the tree first?

hi all, in game search tree there are many algorithms to get the optimal solution, like minimax algorithm. I start learn how to solve this problem with minimax algorithm, the algorithm clear. but I'm confused about the tree itself, in games like tic tac toe number of node not very huge, but on others like chess there are many nodes. i th...