Hello,
I'm trying to develop a view of a hierarchical tree in which the weight of each node is the actual number of children it has. A leaf node has weight 1.
I want to arrange these items in a way they can be browsed going deeper into the tree by showing the root categories (with no parent) at the beginning. Clicking on a node makes t...
Given an N-ary tree, find out if it is symmetric about the line drawn through the root node of the tree. It is easy to do it in case of a binary tree. However for N-ary trees it seems to be difficult
...
I'm working with a tree structure in MySQL that is respresented using the nested sets model.
I'm hoping some of you sql experts can help me with building a SELECT query.
I would like to be able to match a set of nodes using LIKE. For each node that is matched, I also need a comma-delimmited list of the ancestors of that node, and a co...
I've got a couple trees that I allow a user to drag and drop from one to another, works great except one apparent limitation. I'm picking up where they drop it in the list and adding it to the dataProvider manually. The user can drop it everywhere except after the last child of any particular node it seems, since it reads that position a...
On Server Fault, How to list symbolic link chains? (not my question) talks about listing all the symbolic links and following them. To make this doable, let's consider a single directory at first.
I want to write a short utility that does this. It looks easy to put pairs from symbolic links into a hash and then process the hash.
But ...
I'm looking for a "tree of checkboxes" widget for Javascript. I tried to use jquery-checktree which purports to do exactly what I want, however it has the following problems:
It doesn't recognize checkboxes that are already checked and renders everything as unchecked.
It starts off with everything collapsed and doesn't give an option ...
Hi, I write an application that work with tree data structure. I written it with C++, now i want to write it by C#. I use pointers for implementing tree data structure. Is there pointer in C# too? Is using of that safe?
...
Hi, I'm pretty new to Haskell and I'm trying to work out how to traverse a n-ary tree. As output I'm looking to get a list of Leaf values (as the branches have no value), so for testtree this would be: 4,5
My definition so far is:
data Tree a = Leaf a | Branch [Tree a] deriving (Show)
travTree :: Tree a -> [a]
travT...
Given a binary tree, I want to find out the largest subtree which is a BST in it.
Naive approach:
I have a naive approach in mind where I visit every node of the tree and pass this node to a isBST function. I will also keep track of the number of nodes in a sub-tree if it is a BST.
Is there a better approach than this ?
...
Hi, I'm looking for the longest-path trough a map in a game which is turn based. I got 1s computation time and need to move at that point.
Right now I'm generating the tree every move again.
Is it possible to use my old tree and stack (in which I store the nodes yet to be visited) to get a bigger depth and thus a better result?
For n...
I am pretty new to Haskell (still working on totally understanding monads). I have a problem where I have a tree like structure
type Tree = [DataA]
data DataA = DataA1 [DataB]
| DataA2 String
| DataA3 String [DataA]
deriving Show
data DataB = DataB1 [DataA]
| DataB2 String
...
This snippet from official website works as expected:
$treeObject = Doctrine::getTable('Category')->getTree();
$rootColumnName = $treeObject->getAttribute('rootColumnName');
foreach ($treeObject->fetchRoots() as $root) {
$options = array(
'root_id' => $root->$rootColumnName
);
foreach($treeObject->fetchTree($options) as $no...
I'm reading the Cormen algorithms book (binary search tree chapter) and it says that there are two ways to traverse the tree without recursion:
using stack and
a more complicated but elegant
solution that uses no stack but
assumes that two pointers can be
tested for equality
I've implemented the first option (using stack), ...
Hi, I'm trying to find the longest path on a map with grids with like 100 squares (no square can be visited twice). Right now I use a breadt-first tree and calculate the depth and reachable squares for each node, but how do I combine it to select the best possible node?
If I use depth + territory, the first nodes will win, territory*dep...
Hi
I want to build a game tree for nine men's morris game. I want to apply minimax algorithm on the tree for doing node evaluations. Minimax uses DFS to evaluate nodes. So should I build the tree first upto a given depth and then apply minimax or can the process of building the tree and evaluation occur together in recursive minimax DFS...
How do you assign a wsgi app to the root of cherrypy via the config file? I'd like the request "http://localhost:8080/" to route to my own wsgiapp. I'm using cherryd to start a cherrypy server with a config file as follows:
Here's the invocation:
cherryd --config config.cfg --import myapp
Here's the config.cfg file:
[global]
server...
I have an own Tree object implemented in PHP. Say we have a tree like:
Root
|_ Folder 1
|_ Folder 2
|_ Subfolder 1
I can access Subfolder 1 like this:
$sf1 = $Tree->NavigateTo("Folder 2/Subfolder 1")
And $sf1 will hold the Subfolder 1 node. I want to implement a GetParentNode() method, so that
$parent = $sf1->GetParent...
Back to my JaxpTree object. The tree is supposed to convert a MySQL related-table pair into a nested tree that follows such relationship:
/**
* Generates a JaxpTree structure. Parameters are used by the recursive
* function. Normally, they shouldn't be specified.
*
* @param int $parent_id
* @param s...
How would I approach creating a process hierarchy that would look like a balanced ternary tree of depth N? ... meaning each process has 3 children so there would be (3^N-1)/2 processes in a tree of depth N. To create the new processes, I only want to use fork().
This is what I have so far but I don't think it works because I don't deal...
I am trying to construct a general tree. Are there any built in data structures in Python to implement a tree?
...