Search Results

Search found 1139 results on 46 pages for 'hierarchical trees'.

Page 1/46 | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >

  • Design pattern for isomorphic trees

    - by Peregring-lk
    I want to create a data structure to work with isomorphic tree. I don't search for a "algorithms" or methods to check if two or more trees are isomorphic each other. Just to create various trees with the same structure. Example: 2 - - - - - - - 'a' - - - - - - - 3.5 / \ / \ / \ 3 3 'f' 'y' 1.0 3.1 / \ / \ / \ 4 7 'e' 'f' 2.3 7.7 The first "layer" or tree is the "natural tree" (a tree with natural numbers), the second layer is the "character tree" and the third one is the "float tree". The data structure has a method or iterator to traverse the tree and to make diferent operations with its values. These operations could change the value of nodes, but never its structure (first I create the structure and then I configure the tree with its diferent layers). In case of that I add a new node, this would be applied to each layer. Which known design pattern fits with this description or is related with it?

    Read the article

  • What is the usage of Splay Trees in the real world?

    - by Meena
    I decided to learn about balanced search trees, so I picked 2-3-4 and splay trees. What are the examples of splay trees usage in the real world? In this Cornell: http://www.cs.cornell.edu/courses/cs3110/2009fa/recitations/rec-splay.html I read that splay trees are 'A good example is a network router'. But from rest of the explanation seams like network routers use hash tables and not splay trees since the lookup time is constant instead of O(log n).

    Read the article

  • What is the usage of Spaly Trees in the real world?

    - by Meena
    I decided to learn about Balance search trees, so I picked 2-3-4 and splay trees. I'm wondering what are the examples of splay trees usage in the real world? In this Cornell: http://www.cs.cornell.edu/courses/cs3110/2009fa/recitations/rec-splay.html I read that splay trees are 'A good example is a network router'. But from rest of the explanation seams like network routers use hash tables and not splay trees since the lookup time is constant instead of O(log n). thanks!

    Read the article

  • How to find Sub-trees in non-binary tree

    - by kenny
    I have a non-binary tree. I want to find all "sub-trees" that are connected to root. Sub-tree is a a link group of tree nodes. every group is colored in it's own color. What would be be the best approach? Run recursion down and up for every node? The data structure of every treenode is a list of children, list of parents. (the type of children and parents are treenodes) Clarification: Group defined if there is a kind of "closure" between nodes where root itself is not part of the closure. As you can see from the graph you can't travel from pink to other nodes (you CAN NOT use root). From brown node you can travel to it's child so this form another group. Finally you can travel from any cyan node to other cyan nodes so the form another group

    Read the article

  • Inexpensive generation of hierarchical unique IDs

    - by romaninsh
    My application is building a hierarchical structure like this: root = { 'id': 'root', 'children': [ { 'name': 'root_foo', 'children': [] }, { 'id': 'root_foo2', 'children': [ { 'id': 'root_foo2_bar', 'children': [] } ] } ] } in other words, it's a tree of nodes, where each node might have child elements and unique identifier I call "id". When a new child is added, I need to generate a unique identifier for it, however I have two problems: identifiers are getting too long adding many children takes slower, as I need to find first available id My requirement is: naming of a child X must be determined only from the state in their ancestors When I re-generate tree with same contents, the IDs must be same or in other words, when we have nodes A and B, creating child in A, must not affect the name given to children of B. I know that one way to optimize would be to introduce counter in each node and append it to the names which will solve my performance issue, but will not address the issue with the "long identifiers". Could you suggest me the algorithm for quickly coming up with new IDs?

    Read the article

  • Game Trees Conceptual Question

    - by Chris Corbin
    I am struggling to conceptually understand a question in a programming assignment for an algorithms class. The problem is dealing with a fictitious 2 player game, named Easy. The rules of the game are simple; each player may chose one of 4 integers {0-3} after which that integer is not available for the other player. The catch is, a player picks {0} it means they quit. The objective is for Player 1 to get {1} and Player 2 to get {2}, in which case they may win, however if both or neither succeed, then the game ends in a draw. I have been asked to draw the game tree for Easy, showing all nodes, which they explained as 4! = 24. Labeling the edges, which represent moves (selecting a number) and the leaves with who won (1 means Player 1 won, -1 means Player 2 won, and 0 means a tie). I have drawn out a game tree, which I believe is correct, however I am not 100% certain hence I am asking the question. My game tree only has 16 leaves. I am thinking that when a player picks {0}, and then quits, the game tree stops there? I don't see how it is possible to get to 24 leaves? Any help would be greatly appreciate, and if you need more information I would be happy to provide it. Thanks

    Read the article

  • B- trees, B+ trees difference

    - by dta
    In a B- tree you can store both keys and data in the internal/leaf nodes. But in a B+ tree you have to store the data in the leaf nodes only. Is there any advantage of doing the above in a B+ tree? Why not use B- trees instead of B+ trees everywhere? As intuitively they seem much faster. I mean why do you need to replicate the key(data) in a B+ tree?

    Read the article

  • How can I get a distinct list of elements in a hierarchical query?

    - by RenderIn
    I have a database table, with people identified by a name, a job and a city. I have a second table that contains a hierarchical representation of every job in the company in every city. Suppose I have 3 people in the people table: [name(PK),title,city] Jim, Salesman, Houston Jane, Associate Marketer, Chicago Bill, Cashier, New York And I have thousands of job type/location combinations in the job table, a sample of which follow. You can see the hierarchical relationship since parent_title is a foreign key to title: [title,city,pay,parent_title] Salesman, Houston, $50000, CEO Cashier, Houston, $25000 CEO, USA, $1000000 Associate Marketer, Chicago, $75000 Senior Marketer, Chicago, $125000 ..... The problem I'm having is that my Person table is a composite key, so I don't know how to structure the start with part of my query so that it starts with each of the three jobs in the cities I specified. I can execute three separate queries to get what I want, but this doesn't scale well. e.g.: select * from jobs start with city = (select city from people where name = 'Bill') and title = (select title from people where name = 'Bill') connect by prior parent_title = title UNION select * from jobs start with city = (select city from people where name = 'Jim') and title = (select title from people where name = 'Jim') connect by prior parent_title = title UNION select * from jobs start with city = (select city from people where name = 'Jane') and title = (select title from people where name = 'Jane') connect by prior parent_title = title How else can I get a distinct list (or I could wrap it with a distinct if not possible) of all the jobs which are above the three people I specified?

    Read the article

  • drawing hierarchical tree with orthogonal lines ( HV-Drawing – Binary Tree)

    - by user267530
    Hi I need to work on drawing a hierarchical tree structure (HV-Drawing – Binary Tree) with orthogonal lines(straight rectangular connecting lines) between root and children ( like the following: http://lab.kapit.fr/display/visualizationlayouts/Hierarchical+Tree+layout ). I want to know if there are any open source examples of the algorithm of drawing trees like that so that I can implement the same algorithm in actionscript. Thanks Palash

    Read the article

  • drawing hierarchical tree with orthogonal lines

    - by user267530
    Hi I need to work on drawing a hierarchical tree structure with orthogonal lines(straight rectangular connecting lines) between root and children ( like the following: http://lab.kapit.fr/display/visualizationlayouts/Hierarchical+Tree+layout ). I want to know if there are any open source examples of the algorithm of drawing trees like that so that I can implement the same algorithm in actionscript. Thanks Palash

    Read the article

  • Question on Binary Search Trees.

    - by AGeek
    Hi, I was thinking of implementing a binary search trees. I have implemented some very basic operations such as search, insert, delete. Please share your experiences as to what all other operations i could perform on binary search trees, and some real time operations(basic) that is needed every time for any given situation.. I hope my question was clear.. Thanks.

    Read the article

  • OpenGL quake 3 shader file for objects (for trees)

    - by mlodziaszka
    I decided to add to my game few trees, I already quake 3 model loader (md3) its for characters and method for texture drawing is store in *.ini file. I found a package of trees in MD3 and I have no problem with loading model alone, but there is a *.shader file and i have no idea how to load it to draw texture properly. Tree pack: http://www.custommapmakers.org/wiki/index.php/Models:GR_Trees_set I do not have to use exactly this format, I can write another loader, but trees in *.obj or .3ds look even harder

    Read the article

  • Persistent (purely functional) Red-Black trees on disk performance

    - by Waneck
    I'm studying the best data structures to implement a simple open-source object temporal database, and currently I'm very fond of using Persistent Red-Black trees to do it. My main reasons for using persistent data structures is first of all to minimize the use of locks, so the database can be as parallel as possible. Also it will be easier to implement ACID transactions and even being able to abstract the database to work in parallel on a cluster of some kind. The great thing of this approach is that it makes possible implementing temporal databases almost for free. And this is something quite nice to have, specially for web and for data analysis (e.g. trends). All of this is very cool, but I'm a little suspicious about the overall performance of using a persistent data structure on disk. Even though there are some very fast disks available today, and all writes can be done asynchronously, so a response is always immediate, I don't want to build all application under a false premise, only to realize it isn't really a good way to do it. Here's my line of thought: - Since all writes are done asynchronously, and using a persistent data structure will enable not to invalidate the previous - and currently valid - structure, the write time isn't really a bottleneck. - There are some literature on structures like this that are exactly for disk usage. But it seems to me that these techniques will add more read overhead to achieve faster writes. But I think that exactly the opposite is preferable. Also many of these techniques really do end up with a multi-versioned trees, but they aren't strictly immutable, which is something very crucial to justify the persistent overhead. - I know there still will have to be some kind of locking when appending values to the database, and I also know there should be a good garbage collecting logic if not all versions are to be maintained (otherwise the file size will surely rise dramatically). Also a delta compression system could be thought about. - Of all search trees structures, I really think Red-Blacks are the most close to what I need, since they offer the least number of rotations. But there are some possible pitfalls along the way: - Asynchronous writes -could- affect applications that need the data in real time. But I don't think that is the case with web applications, most of the time. Also when real-time data is needed, another solutions could be devised, like a check-in/check-out system of specific data that will need to be worked on a more real-time manner. - Also they could lead to some commit conflicts, though I fail to think of a good example of when it could happen. Also commit conflicts can occur in normal RDBMS, if two threads are working with the same data, right? - The overhead of having an immutable interface like this will grow exponentially and everything is doomed to fail soon, so this all is a bad idea. Any thoughts? Thanks! edit: There seems to be a misunderstanding of what a persistent data structure is: http://en.wikipedia.org/wiki/Persistent_data_structure

    Read the article

  • Configuration Data in a Custom Timer job in Sharepoint 2010 : The Hierarchical Object Store

    - by Gino Abraham
    I was planning for a custom timer job for which i wanted to store some configuration data. Was looking for some best practices, found a useful links on The Hierarchical Object store Store http://www.chaholl.com/archive/2011/01/30/the-skinny-on-sppersistedobject-and-the-hierarchical-object-store-in.aspxInitially was planning for a custom list, but this would make us run a cross site query and the list name and the url should again be kept in some configuration which is an headache to maintain. Hierarchical object store was zeroed in and thanks to google for the same :)

    Read the article

  • Binary Trees in Scheme

    - by Javier
    Consider the following BNF defining trees of numbers. Notice that a tree can either be a leaf, a node-1 with one subtrees, or a node-2 with two subtrees. tree ::= (’leaf number) | (’node-1 tree) | (’node-2 tree tree) a. Write a template for recursive procedures on these trees. b. Define the procedure (leaf-count t) that returns the number of leaves in t > (leaf-count ’(leaf 5)) 1 > (leaf-count ’(node-2 (leaf 25) (leaf 17))) 2 > (leaf-count ’(node-1 (node-2 (leaf 4) (node-2 (leaf 2) (leaf 3))))) 3 Here's what I have so far: ;define what a leaf, node-1, and node-2 is (define leaf list) (define node-1 list) (define node-2 list) ;procedure to decide if a list is a leaf or a node (define (leaf? tree) (number? (car tree))) (define (node? tree) (pair? (car tree))) (define (leaf-count tree) (cond ((null? tree) 0) ((number? tree) 0) ((leaf? tree) 1) (else (+ (leaf-count (car tree)) (leaf-count (cdr tree)))))) It looks like it should run just fine, but when I try to run it using a simple test case like (leaf-count '(leaf 5)) I get the following error message: car: expects argument of type pair; given leaf What does this error message mean? I am defining a leaf as a list. But for some reason, it's not seeing that and gives me that error message.

    Read the article

  • Hierarchical/Nested Database Structure for Comments

    - by Stephen Melrose
    Hi, I'm trying to figure out the best approach for a database schema for comments. The problem I'm having is that the comments system will need to allow nested/hierarchical comments, and I'm not sure how to design this out properly. My requirements are, Comments can be made on comments, so I need to store the tree hierarchy I need to be able to query the comments in the tree hierarchy order, but efficiently, preferably in a fast single query, but I don't know if this is possible I'd need to make some wierd queries, e.g. pull out the latest 5 root comments, and a maximum of 3 children for each one of those I read an article on the MySQL website on this very subject, http://dev.mysql.com/tech-resources/articles/hierarchical-data.html The "Nested Set Model" in theory sounds like it will do what I need, except I'm worried about querying the thing, and also inserting. If this is the right approach, How would I do my 3rd requirement above? If I have 2000 comments, and I add a new sub-comment on the first comment, that will be a LOT of updating to do. This doesn't seem right to me? Or is there a better approach for the type of data I'm wanting to store and query? Thank you

    Read the article

  • .NET Expression Trees Tutorial

    - by zoman
    I've been looking for a good tutorial on Expression trees (C#) for a while, but no luck so far. Most of the stuff I've found on the Web was too high level and very basic. Does anyone know some decent tutorial that goes beyond the fundamentals?

    Read the article

1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >