tree

Transform a java object tree into a 2 dimension table

Hi, I'm faced to the following problem. I have a tree of java objects for which I have to export each field value into a CSV file. The result of the exportation must be similar to what we have in SQL left outer join (called cartesian product). Class author @DataField(pos = 1) String firstName; @DataField(pos = 2) String lastName; @O...

HTML: What determines the 'move the focus to the next control when Enter is hit' behavior

A basic HTML question. Is it possible on an HTML page to declaratively achieve a behavior when pressing Enter in a textbox moves the focus to the next control? How do you achieve it and how do you turn it off? Or maybe the dynamic javascript part should be involved here? For exaple, the following HTML in IE7 does not allow to move to th...

ASCII Library for Creating "Pretty" Directory Trees?

Is there some *nix tool or perl/php library that will let you easily create directory tree visualizations that look like the following? www |-- private | |-- app | | |-- php | | | |-- classes | | | +-- scripts | | |-- settings | | +-- sql | +-- lib | +-- ZendFramework-HEAD +-- public |...

Tree View in c# with recursive

hi there i have table in DB with 3 column => ParentId , Id , Text i wanna make Tree in C# by the Records that we have saved in this table i dont know how should i write my recursive method in c# please help me thanks ...

When to choose RB tree, B-Tree or AVL tree?

As a programmer when should I consider using a RB tree, B- tree or an AVL tree? What are the key points that needs to be considered before deciding on the choice? Can someone please explain with a scenario for each tree structure why it is chosen over others with reference to the key points? ...

Fastest/shortest way to build unique tree in Ruby?

What is the fastest/shortest/one-liner (not possible :p) way to build a unique tree of elements from a tree where many of the elements are duplicated/missing in some nodes, given the tree has a defined set of nodes (which we'd use this algorithm to figure out so we don't have to manually do it). It could be XML/JSON(hash), or whatever. ...

Suggested indices for a MPTT table

I'm just building a table to store hierarchical data using the Modified Pre-order Tree Traversal (MPTT) -- you know the one: each node stores the left and right IDs to find its descendants. I'm using a the CakePHP suggested model, which varies from the standard way by including the parent_id with each row. Here's the suggested table str...

Finding a subtree in a CakePHP Tree

In CakePHP, how do you select just a subtree in a model which actsAs tree? I tried this, to find the tree headed by the item with label = "My Label" $this->find("threaded", array( "conditions" => array( "label" => "My Label" ) )); ...however looking at the logs, it runs this SQL: SELECT Menu.id, Menu.parent_id, Menu....

SubSonic and Tree table structure

I have to store a tree-like structure (think folders, for instance) in my database. The model I chose is pretty simple: the table has a FolderId (PK, int, identity), some random attributes and a nullable ParentId (same-table-FK to FolderId, int, nullable). It all works great and all. I'm using SubSonic's ActiveRecord template. Is there ...

Java tree class's

I'm trying to make my own tree class but keep getting horribly confused. Basically I'm trying to make a weighted tree. I've made the following node class: import java.util.*; public class subdivNode { private int nodevalue; private int nodeID; private List<subdivNode> childnodes; public subdivNode(int value, int id){ nodevalue = ...

Walking a tree, parent first

What is the best way to visit all the nodes of a linked tree (all nodes have references to parent and all children, root nodes have null as parent), so that no node is visited before any of its ancestors? Brownie points for non-recursive. ...

Selecting a tree from a csv using LinQ

I've got a csv with 35K rows with, among other, the following collumns: articleID, description, class1, class2, class 3. the class collumns represent the categories to which the products belong. class1 is the main category, class2 is a subcategory of class1 and class3 is a subcategory of class2. Now i want to extract the categories in a ...

How can I print the syntax tree of all functions in a Perl program?

Hi, perl -MO=Concise,-exec myprog.pl should do it but it only prints the syntax of the lines that are outside any procedures, and the main package itself. It does not print the syntax tree of packages and functions used in myprog and imported. Could someone tell me how to tell "B::Concise" to print all functions in myprog.pl. ...

Flex Tree Visit Indicators

How do I indicate the visit history on a flex tree component? I want to highlight the clicked/visited nodes to a different color and will not change after that, so that all the visited nodes will be one color. I tried adding an attribute to the underlying XML by var selected:XML=app.treeObj.selectedItem as XML; if(!selected.hasOwnProp...

Algorithm to find words spelled out by a number

I'm trying to find a way to determine all possible words that can be spelled out by a given number, given a mapping of alphabets to values. I eventually want to find a solution that works for any 1- or 2- digit value mapping for a letter, but for illustration, assume A=1, B=2, ... Z=26. Example: 12322 can be equal to abcbb (1,2,3,2,2)...

Recursively sort array to levels

Hi, I've been working on a site that uses binary mlm system. Illustration here So I have a two tables in database, users anad relationships. There is ID and personal data columns in users. Relationships has 4 columns: ID, parentID, childID, pos. Where pos is either left or right. I have succesfully written a function that recursively...

How do I print out a tree structure?

I'm trying to improve performance in our app. I've got performance information in the form of a tree of calls, with the following node class: public class Node { public string Name; // method name public decimal Time; // time spent in method public List<Node> Children; } I want to print out the tree such that I can see li...

Tree java how to find a word

I am trying to read a node that will find the longest word in a tree. My method is public static int word(Node d). So how would I have to find the length of that node? Would I just use the string that was made in the class? The class I would use initializes a boolean, String: theWord and children. Here is what I got: int newWord = 0; ...

Display unordered list as a horizontal binary tree

Hi, I have a binary tree in unordered list that looks like this: <ul> <li>1 <ul> <li>2 <ul> <li>4 <ul> <li>8</li> <li>--</li> </ul> </li> <li>5</li> </ul> </li> <li>3 <ul> <li>6</li> <li>7</li> </ul> </li> </ul> </li> Where -- is a empty space (to differ ...

java binary search tree

Hello. I have a question about how would I remove a child from a node (root)? Since I can't call remove, if I make the child null, will the children of that child move up? Like, would I just initialize it as null?? Or would I point to the child's child? ...