tree

Flex tree drag and drop

I have a flex application with 2 tree. I should allow the drag and drop from left tree to right tree based on the local name of XML. While working on this I encountered peculiar kind of problems. when dragged and dropped to right tree from left tree, the dragged item in lefttree is appearing twice when certain items are dragged to rig...

Applying a Logarithm to Navigate a Tree

I had once known of a way to use logarithms to move from one leaf of a tree to the next "in-order" leaf of a tree. I think it involved taking a position value (rank?) of the "current" leaf and using it as a seed for a fresh traversal from the root down to the new target leaf - all the way using a log function test to determine whether t...

Is there a way to tell if I'm using recursion in Python?

I'm writing a function to traverse the user's file system and create a tree representing that directory (the tree is really a TreeView widget in Tkinter, but that's functionally a tree). The best way I can think of doing this is recursion. However, one of my cases in the function requires me to know if it is the "original" function call...

Makefile issue: smart way to scan directory tree for .c files

I am doing a project which is growingprety fast and keeping the object files up date is no option. The problem beyon wildcard command lies somewhere between "I do not want recursive makefiles" and "I do not want it to list by hand". The objects are supposed to go into a seperate diretory, which works allready. Note: I am not that used to...

OnSelect handler with XUL and Javascript

So I have a tree of items created using XUL. When I select item from this tree and click a View button I want to display information about the selected item. I do it as below but the button does not work at all. Assign an id for the tree: <tree id="assetList" flex="1" multiple="false"> Then I attach a function to the button: <button...

How can I delete item from a nested XUL tree?

I created a nested tree using XUL (no database was used to store items). I want to delete items from this tree by selecting the item (only 1 at a time) then click delete. I wrote Javascript function to delete as following but it does not work. function delete(){ var tree = document.getElementById("treeId"); currentPos = tree.cur...

Find the successor in a BST without using parent pointer

The successor of an element in a BST is the element's successor in the sorted order determined by the inorder traversal. Finding the successor when each node has a pointer to its parent node is presented in CLRS's algorithm textbook. (Intro to algorithm by MIT press). Now I am thinking another question, can we find the successor without ...

data structure programming algorithm

how to draw binary trees whose preorder listing is abcdefgh and whose postorder listing is dcbgfhea.also,list the nodes of binary trees in inorder and level order ? ...

SQL tree traversal

I am not totally sure I am naming this right, but please bear with me. I am wondering if is possible to do something like this in SQL(MySQL specifically): Let's say we have tree-like data that is persisted in the database in the following table: mysql> desc data_table; +------------------------+---------------------+------+-----+--...

Crating dictionary with binary search tree and hashing

I’m about to create a "smart" dictionary that could generate similar words if the word from the user is not in the dictionary. The dictionary starts with reading a file with words, the word should be added to the binary tree and a hash table. The hash table is used to determine if the word or similar word is in the dictionary, the hash ...

Removing/deleting subtrees in SML

Hey, i want to program a function delete that given a tree, i can delete a node in the tree so it should return the original tree minus the node and the subtree of this node. every hint helps, and thanx in advance:) ...

Parse string into a tree structure?

I'm trying to figure out how to parse a string in this format into a tree like data structure of arbitrary depth. "{{Hello big|Hi|Hey} {world|earth}|{Goodbye|farewell} {planet|rock|globe{.|!}}}" [[["Hello big" "Hi" "Hey"] ["world" "earth"]] [["Goodbye" "farewell"] ["planet" "rock" "globe" ["." "!"]]]] ...

Convert 2d array into 3d with PHP

There are simple 2d array with some sort of tree like this: node1 node2 node3 It's structure is: array( array ( 'id' : 1, 'pid': 0, 'title' : 'node1', 'level' : 1 ), array ( 'id' : 2, 'pid': 1, 'title' : 'node2', 'level' : 2 ), array ( 'id' : 3, 'pi...

db schema to store and read multiple level access control

Scenario: I have organization, in org I have departmenst, in depts' I have groups, in groups I have users. I have courses. I can give access to any combination of users/groups/departments/organizations. Each level inherit the access it's parent has (so every course which is available to the organization is also available to all of it's ...

extjs: load tree via json returned from Ext.data.JsonStore

Hi All i have a extjs TreePanel that i need to load using json data (cross-domain call) returned from my Ext.data.JsonStore call. That works perfectly. I just cant find a way to use the returned jsonStore to load the treepanel. Any ideas? I am real desperado. Thanks everyone! code snippet: var store = new Ext.data.JsonStore({ roo...

Binary trees in C++ using references

I wish to implement a binary tree using references instead of using pointers (which is generally what you tend to find in every book and every website on the internet). I tried the following code: class tree_node { private: tree_node& left; tree_node& right; data_type data; public: void set_left(tree_node&); // ... o...

How can I generate a directory tree from a root folder and all it's sub folders?

okay, so I'm trying to get a directory of folders and sub folders, but it just goes into a infinite loop. What is a better way to create a directory of folders and sub-folders? Cause I really have no idea. this is my code so far: #include <sys/types.h> #include <sys/stat.h> #include <dirent.h> #include <errno.h> #include <vector> #incl...

How to store OpenGL Primitives in a tree data structure in C++ ?

I'm new to OpenGL and C++. Say I start with a 2D square (on the very left) like shown in the picture below. I want to make it interactive with the glutKeyboardFunc() so when I press a number a new box will draw next to the corresponding edge. Figure the best way to do this is to have a tree structure that hold all the boxes. But I'm n...

reliable HTML/Ajax control to manipulate tree structures?

Can someone recommend a reliable HTML tree control that also supports tree manipulation? I need it for a backend and want to move, reorder, delete, add and rename nodes. Right now i use a nested set model in my database to store the tree structure, and dhtmlxTree (see dhtmlx.com) as tree control. The problem i'm having is that this co...

merge two splay tree

How to merge two splay tree with amortized cost of log(n)? ...