Questions tagged [tree]

A tree is a widely-used data structure that emulates a hierarchical tree-like structure with a set of linked nodes.

0
votes
1answer
16 views

How can choose number of nods in rpart?

In tree package we can use following code for choosing number of terminal nods:tree.model=tree(...)tree.prune=prune.tree(tree.model, best=20)This code returns a new tree with 20 terminal ...
0
votes
0answers
19 views

Prove: if tree has n vertices, it has n-1 edges

This is question number 1-17 in the "Algorithm Design Manual 2nd Ed." by Steven S. Skiena.I found a solution to this question here, http://compalg.inf.elte.hu/~tony/Oktatas/TDK/FINAL/Chap%204.PDF....
0
votes
0answers
17 views

How use tree with loss matrix in r?

I use tree package for classification. I see help of prune.tree() command have a loss argument but when I set loss matrix, it has not influence on tree result. But why?I can use rpart package for ...
1
vote
1answer
29 views

why are the nodes of my huffman code not sorted properly? C

I am trying to debug my Huffman Code and found out the when I am calling my buildHuffmanTree and printing the nodes of my minHeap using the print function that I commented out below, I get a ...
0
votes
0answers
5 views

How does searching in a filesystem works? How does searching in GDrive work?

So I am working on a web based filesystem similar to google drive. I wonder how does the search feature works. Does it index the files? If so, then how?Also, my small project does not have a backend....
0
votes
0answers
10 views

How can I fix: Error in `[.data.frame`(m, labs) : undefined columns selected

I am trying to create a classification tree with R Studio, with the package rpart.They are the answers from a survey, in which at the end they registered a consumption level of media usage. I want ...
0
votes
1answer
19 views

Stack lists into nested list like a matryoshka in python

I have some "big" lists, that fit into some other lists of the same list of the "big" lists, and I would like to map the sublists into one another, to get the one containing all the others. Its sorted ...
1
vote
2answers
22 views

R from grouped dataframe to Sankey diagram

I've been spending most of yesterdays time on the following problem and haven't found a solution yet to the following problem:I have a dataframe with categorical data: say category1: has values A ...
0
votes
2answers
30 views

Urls/Array to Tree list in javascript

I have the following list:[{'http://www.example.com/something/index.htm'}, {'http://www.example.com/something/other.htm'},{'http://www.example.com/thatthing/about.htm'},{'http://www....
-2
votes
1answer
31 views

Check if class is inside a class - Python

I'd like to know if a class is located inside a class.For instance:class Example:class InsideExample:passI'd like to check if InsideExample is inside Example. How would I do that?...
-3
votes
0answers
25 views

How to implement minimax using two lists for two player game in python [on hold]

I am implementing minimax algorithm and I am facing difficulties in the data structure formation. There are two set of lists for the two players and one optional common list which both players can act ...
0
votes
0answers
25 views

Python - Lark - Grammar - Can not generate AST

i am currently trying to generate an abstract syntax tree from a functional expression, which could be for example:OR(FunctionOne("valueA", "valueB", "valueC"), FunctionTwo("valueD", "valueE", "...
0
votes
0answers
11 views

R - Classification using CODEX

I have the following question.I have a classification of actives in one file, this classification have the following structure.Active 'A' : - 'AA' -'ABC'-'ACS'...
0
votes
1answer
15 views

Getting precise DOM TREE for clicked element

I'm trying to get precise DOM TREE up to clicked element.If you try it you will see it works. But not exactly right. It doesn't separate click .container first DOM from second DOM element.What ...
1
vote
0answers
25 views

Finding the predicate of a sentence:

For an example, we have a sentence saying "I just played the biggest event in the world". The predicate here is the "played". I know that I should tokenized the sentence and then use the nltk to ...
1
vote
2answers
25 views

Trouble with references in Python (trees)

I'm trying to remove all subtrees that only contain zeros. My code is below. Right now, running removeFailures on the root node does not modify the tree at all (doing preorder traversal before and ...
0
votes
1answer
30 views

How to Trim a General Tree of Tic Tac Toe Boards - Java Recursion

I am trying to make each parent node (every node) show me a how many wins and losses its subtree has. This will allow me to play a computer such that the computer can optimize its move by going to ...
1
vote
1answer
27 views

(Python) Alternating inputs from a binary tree?

So I've just begun the meat and potatoes of my degree and I'm learning Python. One of our assignments this week was to use a binary tree and add guests, allowing the tree to alternate left and right, ...
0
votes
0answers
15 views

Left-leaning red-black tree max depth

I am trying to figure out the max depth of a left-leaning red-black tree, but i am not sure how to go about this.I know that it is 2log(n+1) for a red black tree, but for a balanced red black tree i ...
0
votes
0answers
9 views

What are the problems in leetcode that can be solved by Segment Tree with Lazy Propagation?

To prepare coding algorithm, I want to practice more on Lazy Propagation Segment Tree.What are the problems in leetcode.com (or lintcode.com) that can be solved by Segment Tree with Lazy Propagation?...
-1
votes
0answers
13 views

Binary Trees C++

I am new to stack overflow.And I am stuck with this tree problem for days/months. Suppose the root node has a value of 'x'.I want its right child to be 3*x and left child to be 2*x; I want this till a ...
1
vote
1answer
52 views

is not the benefit of B-Tree lost when it is saved in File?

I was reading about B-Tree and it was interesting to know that it is specifically built for storing in secondary memory. But i am little puzzled with few points:If we save the B-Tree in secondary ...
0
votes
0answers
6 views

Convert multiple sequence alignment fasta to newick format, but without altering the position of the sequences

I have a multiple sequence alignment produced in clustalW and in fasta format. I need to convert it to newick format but keep the order of the sequences, so no UPGMA or neighbour join, just a straight ...
-2
votes
0answers
30 views

I need to make a tree containg all possible moves in tic tac toe in java [on hold]

As the title says i need to make a tree with the root containg all 9 possibles moves for x with each of those containg "O"s 8 possible remaning moves etc untill all 362,000 possibilities are filled i ...
-2
votes
0answers
19 views

Calculate characteristic polynomial of a tree efficiently? [on hold]

How to calculate characteristic polynomial of adjacency matrix of a tree efficiently? n<=2000 where n are number of nodes. where characteristic polynomial is det((lambda)I-A), where I is identity ...
0
votes
1answer
11 views

Search for function in Object and list its path

I have an object with different attributes and functions.My object looks like the following: data.user.identificationNow this object has a function somewhere in his tree called "GetName"This ...
0
votes
1answer
59 views

Using stack to make file/directory tree in Java

I need to return or print a file/directory tree using stack data structure. For example:Folder1Folder1.1File1.1.1Folder1.2Folder2File2.1File2.2...My code so far:...
2
votes
2answers
41 views

How to declare a function in Class instead of outside of the Class in python

I'm quite new to python and algorithm and I want to declare a function inside the class rather than outside of it. The followings are what I have now:A general Tree Class NAryTree implementation:...
0
votes
1answer
54 views

Is possible to avoid recurrence in a method call in php when the object added to the list is the same?

I have a method in a class that receives an element and put it into a list, the class has another method that prints that list like a Tree, but the problem is when you add the same object as a child ...
-1
votes
0answers
8 views

Hierarchically numbering a Adobe Flex Tree

I have a dynamic tree and I want to number it in the following manner while displaying it.1. Item 1--- 1.1 Item 2--- 1.1.1 Item 2--- 1.2 Item 32. Item 2Also, while dragging and ...

153050per page
angop.ao, elkhabar.com, noa.al, afghanpaper.com, bbc.com, time.com, cdc.gov, nih.gov, xnxx.com, github.com,