Search Results

Search found 4391 results on 176 pages for 'tree hacker'.

Page 18/176 | < Previous Page | 14 15 16 17 18 19 20 21 22 23 24 25  | Next Page >

  • Finding the heaviest length-constrained path in a weighted Binary Tree

    - by Hristo
    UPDATE I worked out an algorithm that I think runs in O(n*k) running time. Below is the pseudo-code: routine heaviestKPath( T, k ) // create 2D matrix with n rows and k columns with each element = -8 // we make it size k+1 because the 0th column must be all 0s for a later // function to work properly and simplicity in our algorithm matrix = new array[ T.getVertexCount() ][ k + 1 ] (-8); // set all elements in the first column of this matrix = 0 matrix[ n ][ 0 ] = 0; // fill our matrix by traversing the tree traverseToFillMatrix( T.root, k ); // consider a path that would arc over a node globalMaxWeight = -8; findArcs( T.root, k ); return globalMaxWeight end routine // node = the current node; k = the path length; node.lc = node’s left child; // node.rc = node’s right child; node.idx = node’s index (row) in the matrix; // node.lc.wt/node.rc.wt = weight of the edge to left/right child; routine traverseToFillMatrix( node, k ) if (node == null) return; traverseToFillMatrix(node.lc, k ); // recurse left traverseToFillMatrix(node.rc, k ); // recurse right // in the case that a left/right child doesn’t exist, or both, // let’s assume the code is smart enough to handle these cases matrix[ node.idx ][ 1 ] = max( node.lc.wt, node.rc.wt ); for i = 2 to k { // max returns the heavier of the 2 paths matrix[node.idx][i] = max( matrix[node.lc.idx][i-1] + node.lc.wt, matrix[node.rc.idx][i-1] + node.rc.wt); } end routine // node = the current node, k = the path length routine findArcs( node, k ) if (node == null) return; nodeMax = matrix[node.idx][k]; longPath = path[node.idx][k]; i = 1; j = k-1; while ( i+j == k AND i < k ) { left = node.lc.wt + matrix[node.lc.idx][i-1]; right = node.rc.wt + matrix[node.rc.idx][j-1]; if ( left + right > nodeMax ) { nodeMax = left + right; } i++; j--; } // if this node’s max weight is larger than the global max weight, update if ( globalMaxWeight < nodeMax ) { globalMaxWeight = nodeMax; } findArcs( node.lc, k ); // recurse left findArcs( node.rc, k ); // recurse right end routine Let me know what you think. Feedback is welcome. I think have come up with two naive algorithms that find the heaviest length-constrained path in a weighted Binary Tree. Firstly, the description of the algorithm is as follows: given an n-vertex Binary Tree with weighted edges and some value k, find the heaviest path of length k. For both algorithms, I'll need a reference to all vertices so I'll just do a simple traversal of the Tree to have a reference to all vertices, with each vertex having a reference to its left, right, and parent nodes in the tree. Algorithm 1 For this algorithm, I'm basically planning on running DFS from each node in the Tree, with consideration to the fixed path length. In addition, since the path I'm looking for has the potential of going from left subtree to root to right subtree, I will have to consider 3 choices at each node. But this will result in a O(n*3^k) algorithm and I don't like that. Algorithm 2 I'm essentially thinking about using a modified version of Dijkstra's Algorithm in order to consider a fixed path length. Since I'm looking for heaviest and Dijkstra's Algorithm finds the lightest, I'm planning on negating all edge weights before starting the traversal. Actually... this doesn't make sense since I'd have to run Dijkstra's on each node and that doesn't seem very efficient much better than the above algorithm. So I guess my main questions are several. Firstly, do the algorithms I've described above solve the problem at hand? I'm not totally certain the Dijkstra's version will work as Dijkstra's is meant for positive edge values. Now, I am sure there exist more clever/efficient algorithms for this... what is a better algorithm? I've read about "Using spine decompositions to efficiently solve the length-constrained heaviest path problem for trees" but that is really complicated and I don't understand it at all. Are there other algorithms that tackle this problem, maybe not as efficiently as spine decomposition but easier to understand? Thanks.

    Read the article

  • Expression Tree : C#

    - by nettguy
    My understanding of expression tree is : Expression trees are in-memory representation of expression like arithmetic or boolean expression.The expressions are stored into the parsed tree.so we can easily transalate into any other language. Linq to SQL uses expression tree.Normally when our LINQ to SQL query compiler translates it to parsed expression trees.These are passed to Sql Server as T-SQL Statements.The Sql server executes the T-SQL query and sends down the result back.That is why when you execute LINQ to SQL you gets IQueryable<T> not IEnumetrable<T>.Because IQuerybale contains public IQueryable:IEnumerable { Type Element {get;} Expression Expression {get;} IQueryaleProvider Provider {get;} } Questions : Microsoft uses Expression trees to play with LINQ-to-Sql.What are the different ways can i use expression trees to boost my code. Apart from LINQ to SQL,Linq to amazon ,who used expression trees in their applications? Linq to Object return IEnumerable,Linq to SQL return IQueryable ,What does LINQ to XML return?

    Read the article

  • WPF: Calling a method from a different "branch" of the tree

    - by sofri
    Hey, I'm doing a WPF Application. The tree looks like this: SurfaceWindow --- Startscreen ..........................-------- Page---------- Subpage I'm trying to call a method from the "Subpage" from the "Code Behind" of the Startscreen(Startscreen.xaml.cs). The method from the Subpage looks like this: public void showTheme(ThemeViewModel theme) { ... } If know that I can call it when I'm on the "Page" or the "SurfaceWindow", because it's in the same "branch" of the tree, and I just do something like this: ThemeViewModel theme = (ThemeViewModel)mvm.CurrentItem.ThemeViewModel; katalog.katalogblatt.showTheme(theme); But how do I do it when I'm not on the same branch of the tree and want to call the method?

    Read the article

  • Secondary keys in a B-tree

    - by Phenom
    Let's say that there is a file that contains an unsorted list of student information, which includes a student ID number as well as other information. I want to make a program that retrieves student information based on student ID number. In order to make it efficient, I store the student IDs in a B-tree. So when I enter a student ID number, it searches the B-tree to see if its there or not. It also does one more thing. If it finds the student ID number, then it also returns where in the file that student's information is. This is the secondary key. The program uses this information to locate the rest of the student's information and prints it to screen. Can this be done? Is this how a b-tree works?

    Read the article

  • Tree data structure in php

    - by Piyush
    in my application user starts a new tree or get added under a child-user and keep on adding users in branches in such a way- >there are 10 level of tree type structure. >root node contain 1 user and each node(user) can have max 5 child-user in this way tree will be like level 0 = 1 user , level 1 = 5 user, level 2 = 25 user , level 3 = 125 user and so on. I created one MySQL table having columns like- User_id , level, super_id, child1_id, child2_id, child3_id, child4_id, child5_id my question is How can I get all child-user(child to child also) of a particular user at any level do I need to add some more columns in my table??

    Read the article

  • WPF Logical Tree - bottom up vs. top down

    - by Dor Rotman
    Hello, I've read the MSDN article about the layouts pass, that states: When a node is added or removed from the logical tree, property invalidations are raised on the node's parent and all its children. As a result, a top-down construction pattern should always be followed to avoid the cost of unnecessary invalidations on nodes that have already been validated. Now lets assume I do this. Won't the users see the control tree populate itself and the layout change several times during the control creation process? I want the whole control tree to just appear completely full. Thanks!

    Read the article

  • java - Depth First Search - Perform DFS on a tree

    - by DJDonaL3000
    Im trying to perform DFS on a Minimum Spanning Tree which contains 26 nodes. Nodes are named 'A' to 'Z' and the tree is undirected. I have an empty function called DFS here that I am trying to write, which (i presume) takes in the tree (a 2D array) a startNode (randomly selected node 'M') and the endNode (randomly selected node 'Z'). The weights of connected nodes are identified in the 2D array parameter, but how do I actually get started visiting nodes? All that is required is to print each nodeName in the order of the DFS traversal. Do I need to create a Node_class for each node in the 2d array??

    Read the article

  • Constructing a tree using Python

    - by stealthspy
    I am trying to implement a unranked boolean retrieval. For this, I need to construct a tree and perform a DFS to retrieve documents. I have the leaf nodes but I am having difficulty to construct the tree. Eg: query = OR ( AND (maria sharapova) tennis) Result: OR | | AND tennis | | maria sharapova I traverse the tree using DFS and calculate the boolean equivalent of certain document ids to identify the required document from the corpus. Can someone help me with the design of this using python? I have parsed the query and retrieved the leaf nodes for now.

    Read the article

  • Un hacker de 12 ans pirate des sites officiels pour Anonymous en échange de jeux vidéo, « et il a dit aux autres comment faire » ajoute la police

    Un hacker de 12 ans pirate des sites officiels pour Anonymous en échange de jeux vidéo, « et il a dit aux autres comment faire » ajoute la police 12 ans et il plaide déjà coupable à trois chefs d'accusation de piratage par un tribunal canadien. L'élève de cinquième qui avait alors 11 ans au moment des faits a aidé le collectif Anonymous à lancer des attaques DDoS contre des sites gouvernementaux pendant la crise estudiantine québécoise de l'année passée. Avec la promesse d'obtenir des jeux...

    Read the article

  • Single-port 2600 router with 2900XL switch

    - by Slava Maslennikov
    I have a setup, where the single port 2600 router is in port 0/2 in the switch, outside network is on port 0/1, and the rest (0/3-0/24) should be clients for the second network that would be managed by the 2600 router. I configured everything with two VLANs: 100 for outside (0/2-0/24), 200 for inside (0/1-0/2). 0/2 is a trunk port for the two VLANs. The issue that came about is that I can't have two VLANs on at once: software doesn't allow it. Now, I can ping the outside network devices (172.16.7.1, 172.16.7.103), and even google (8.8.8.8) from the router, but not the switch. Devices on connected get a DHCP lease properly but can't ping outside the network, just the router - 172.17.7.1 and the switch itself, 172.17.7.7. The configuration for both the router and the switch are here, as well as below. Router: rt.throom#sho run Building configuration... Current configuration : 1015 bytes ! version 12.1 no service single-slot-reload-enable service timestamps debug uptime service timestamps log uptime no service password-encryption ! hostname rt.throom ! enable password To053cret ! ! ! ! ! no ip subnet-zero ip dhcp excluded-address 172.17.7.1 172.17.7.2 ip dhcp excluded-address 172.17.7.3 172.17.7.4 ip dhcp excluded-address 172.17.7.5 ! ip dhcp pool VLAN200 network 172.17.7.0 255.255.255.0 default-router 172.17.7.1 dns-server 8.8.8.8 ! ip audit notify log ip audit po max-events 100 ! ! ! ! ! ! ! interface Ethernet0/0 no ip address ! interface Ethernet0/0.100 encapsulation dot1Q 100 ip address 172.16.7.15 255.255.255.0 ip nat outside ! interface Ethernet0/0.200 encapsulation dot1Q 200 ip address 172.17.7.1 255.255.255.0 ip nat inside ! router eigrp 20 network 172.16.0.0 network 172.17.0.0 no auto-summary no eigrp log-neighbor-changes ! no ip classless no ip http server ! access-list 1 permit 172.17.7.0 0.0.0.255 ! ! line con 0 line aux 0 line vty 0 4 login ! end Switch: sw.throom#sho run Building configuration... Current configuration: ! version 11.2 no service pad no service udp-small-servers no service tcp-small-servers ! hostname sw.throom ! enable password Oh5053cret ! ! no spanning-tree vlan 100 no spanning-tree vlan 200 ip subnet-zero ! ! interface VLAN1 no ip address no ip route-cache ! interface FastEthernet0/1 switchport access vlan 100 spanning-tree portfast ! interface FastEthernet0/2 switchport trunk encapsulation dot1q switchport mode trunk ! interface FastEthernet0/3 switchport access vlan 200 spanning-tree portfast ! interface FastEthernet0/4 switchport access vlan 200 spanning-tree portfast ! interface FastEthernet0/5 switchport access vlan 200 spanning-tree portfast ! interface FastEthernet0/6 switchport access vlan 200 spanning-tree portfast ! interface FastEthernet0/7 switchport access vlan 200 spanning-tree portfast ! interface FastEthernet0/8 switchport access vlan 200 spanning-tree portfast ! interface FastEthernet0/9 switchport access vlan 200 spanning-tree portfast ! interface FastEthernet0/10 switchport access vlan 200 spanning-tree portfast ! interface FastEthernet0/11 switchport access vlan 200 spanning-tree portfast ! interface FastEthernet0/12 switchport access vlan 200 spanning-tree portfast ! interface FastEthernet0/13 switchport access vlan 200 spanning-tree portfast ! interface FastEthernet0/14 switchport access vlan 200 spanning-tree portfast ! interface FastEthernet0/15 switchport access vlan 200 spanning-tree portfast ! interface FastEthernet0/16 switchport access vlan 200 spanning-tree portfast ! interface FastEthernet0/17 switchport access vlan 200 spanning-tree portfast ! interface FastEthernet0/18 switchport access vlan 200 spanning-tree portfast ! interface FastEthernet0/19 switchport access vlan 200 spanning-tree portfast ! interface FastEthernet0/20 switchport access vlan 200 spanning-tree portfast ! interface FastEthernet0/21 switchport access vlan 200 spanning-tree portfast ! interface FastEthernet0/22 switchport access vlan 200 spanning-tree portfast ! interface FastEthernet0/23 switchport access vlan 200 spanning-tree portfast ! interface FastEthernet0/24 switchport access vlan 200 spanning-tree portfast ! ! line con 0 stopbits 1 line vty 0 4 login line vty 5 9 login ! end sho ip route gives: Gateway of last resort is 172.16.7.1 to network 0.0.0.0 172.17.0.0/24 is subnetted, 1 subnets C 172.17.7.0 is directly connected, Ethernet0/0.200 172.16.0.0/24 is subnetted, 1 subnets C 172.16.7.0 is directly connected, Ethernet0/0.100 S* 0.0.0.0/0 [1/0] via 172.16.7.1

    Read the article

  • lists searches in SYB or uniplate haskell

    - by Chris
    I have been using uniplate and SYB and I am trying to transform a list For instance type Tree = [DataA] data DataA = DataA1 [DataB] | DataA2 String | DataA3 String [DataA] deriving Show data DataB = DataB1 [DataA] | DataB2 String | DataB3 String [DataB] deriving Show For instance, I would like to traverse my tree and append a value to all [DataB] So my first thought was to do this: changeDataB:: Tree -> Tree changeDataB = everywhere(mkT changeDataB') chanegDataB'::[DataB] -> [DataB] changeDataB' <add changes here> or if I was using uniplate changeDataB:: Tree -> Tree changeDataB = transformBi changeDataB' chanegDataB'::[DataB] -> [DataB] changeDataB' <add changes here> The problem is that I only want to search on the full list. Doing either of these searches will cause a search on the full list and all of the sub-lists (including the empty list) The other problem is that a value in [DataB] may generate a [DataB], so I don't know if this is the same kind of solution as not searching chars in a string. I could pattern match on DataA1 and DataB3, but in my real application there are a bunch of [DataB]. Pattern matching on the parents would be extensive. The other thought that I had was to create a data DataBs = [DataB] and use that to transform on. That seems kind of lame, there must be a better solution.

    Read the article

  • inodes and tree-depth in ext2

    - by David Hagan
    I have an ext2 filesystem with a maximum number of inodes per directory (somewhere around 32k), and also a maximum number of inodes in the entire filesystem (somewhere around 350m). Because I'm using this filesystem as a datastore for a service that has in excess of 32k objects, I'm distributing those objects between multiple subdirectories (like a dictionary separates A-K and L-Z). My question is this: Is there any significance to the tree depth when I'm building these inodes? Is there a significant difference or limitation that's going to affect my service if I choose "/usr/www/service/data/a_k/aardvark" over "/data/a_k/aardvark"?

    Read the article

  • Is Family Tree Maker 2011 the right upgrade?

    - by bill weaver
    My father has used Family Tree Maker for years, but hasn't upgraded since version 11. It is difficult to tell from reviews at Amazon and other places whether upgrading to FTM 2011 is a good choice. File incompatibilities and upgrade woes sound like customer service is lacking, and i've read reports of it uploading your data to their database but then trying to sell you a download of data. Looking at the ancestry.com site makes me think it's solely about selling add-ons and upgrades. On the other hand, the feature set seems fairly rich and the software has a pretty strong following. I was able to get Gramps working on my system, but that's not going to work for my dad. Any advice on a good upgrade path? Doesn't necessarily have to be FTM. The only requirement is a way to import his existing data.

    Read the article

  • Advanced merge directory tree with cp in Linux

    - by mtt
    I need to: Copy all of a tree's folders (with all files, including hidden) under /sourcefolder/* preserving user privileges to /destfolder/ If there is a conflict with a file (a file with the same name exists in destfolder), then rename file in destfolder with a standard rule, like add "old" prefix to filename (readme.txt will become oldreadme.txt) copy the conflicted file from source to destination Conflicts between folders should be transparent - if same directory exists in both sourcefolder and destfolder, then preserve it and recursively copy its content according to the above rules. I need also a .txt report that describes all files/folders added to destfolder and files that were renamed. How can I accomplish this?

    Read the article

  • Find kth smallest element in a binary search tree in Optimum way

    - by Bragaadeesh
    Hi, I need to find the kth smallest element in the binary search tree without using any static/global variable. How to achieve it efficiently? The solution that I have in my mind is doing the operation in O(n), the worst case since I am planning to do an inorder traversal of the entire tree. But deep down I feel that I am not using the BST property here. Is my assumptive solution correct or is there a better one available ?

    Read the article

  • Implement a decision tree in SharePoint

    - by ria
    What is the best way to implement a decision tree in SharePoint? Is there a web part available? Does any of Sharepoint's Fab 40 templates contain a decision tree web part? i have searched but i couldnt find a useful answer anywhere. Please suggest.

    Read the article

  • Tree and List on the same page

    - by Jamie
    Hi All! Using Grails and the RichUI plugin to display a tree, and it works fine. When I click one of the Nodes in the tree I show a list(table) from a controller. I should be able to create new, edit and sort. My problem is that pagination doesn't work and also sorting!!! Are there anyone who has done this, or can it be done differently ? Best Regards Jamie

    Read the article

  • Skip List vs. Binary Tree

    - by Claudiu
    I recently came across the data structure known as a Skip list. They seem to have very similar behavior to a binary search tree... my question is - why would you ever want to use a skip list over a binary search tree?

    Read the article

  • Simple Fundamental Algorithm Question, binary tree traversal

    - by Ben
    I'm trying to explain to non-computer science major student with many questions. (1)What traverses tree? Is it just logic or actual on off switch generates 1s and 0s traveling the circuit board? where is this tree and node exists CPU/Memory in between? (2)If it is 1s and 0s HOW the circuits understand the line for example p=p.getLeft(); I said search the google or wiki.

    Read the article

  • Recursive breadth first tree traversal

    - by dugogota
    I'm pulling my hair out trying to figure out how to implement breadth first tree traversal in scheme. I've done it in Java and C++. If I had code, I'd post it but I'm not sure how exactly to begin. Given the tree definition below, how to implement breadth first search using recursion? (define tree1 '( A ( B (C () ()) (D () ()) ) (E (F () ()) (G () ())) )) Any help, any, is greatly appreciated.

    Read the article

  • 2 sided winform Tree - exist?

    - by Avi Harush
    Hi, I'm looking for a 2 sided winform Tree control. something like what you see in the math books. meaning that the tree can go both right and left in the control. Something like http://www.math.bas.bg/~nkirov/2010/NETB201/slides/ch06/pic3.jpg Thanks Avi

    Read the article

  • C++ print out a binary search tree

    - by starcorn
    Hello, Got nothing better to do this Christmas holiday, so I decided to try out making a binary search tree. I'm stuck with the print function. How should the logic behind it work? Since the tree is already inserting it in a somewhat sorted order, and I want to print the tree from smallest values to the biggest. So I need to travel to the furthest left branch of the tree to print the first value. Right, so after that how do I remember the way back up, do I need to save the previous node? A search in wikipedia gave me an solution which they used stack. And other solutions I couldn't quite understand how they've made it, so I'm asking here instead hoping someone can enlight me. I also wonder my insert function is OK. I've seen other's solution being smaller. void treenode::insert(int i) { if(root == 0) { cout << "root" << endl; root = new node(i,root); } else { node* travel = root; node* prev; while(travel) { if(travel->value > i) { cout << "travel left" << endl; prev = travel; travel = travel->left; } else { cout << "travel right" << endl; prev = travel; travel = travel->right; } } //insert if(prev->value > i) { cout << "left" << endl; prev->left = new node(i); } else { cout << "right" << endl; prev->right = new node(i); } } } void treenode::print() { node* travel = root; while(travel) { cout << travel->value << endl; travel = travel->left; } }

    Read the article

  • Javascript: getting element in dom tree when mouseover

    - by oimoim
    Hi, When using : document.onmouseover = function(e) {} Is there a property which gives me the element in the dom tree ? For example, I can set a style to e.srcElement But, how can I later access this element to (for example) reset its style ? And how can I know at which place in the dom tree it is ? I want to be able to situate it in the whole page dump. Many thanks.

    Read the article

< Previous Page | 14 15 16 17 18 19 20 21 22 23 24 25  | Next Page >