Questions tagged [subtree]
172 questions
0
votes
1 answer
Equivalent subtree
I have two trees. The tree Node is defined as
class Node{
String treeId;
String type; //Each node has type which has fixed value. For example, its color: RED, BLANK, GREEN
Set children;
String ref; //The ref is a string…

shijie xu
- 1,975
- 21
- 52
0
votes
1 answer
add subtree below more than one nodes in a graph
I am using Java JUNG 2.0.1 version. I understand basics of JUNG API.
I have a tree with root vertex as 1 [see Input graph].
Basically, I want to remove an edge (from:1 to:3) i.e. have sub-tree where root is vertex 3 and add it below vertex 2…

Misha
- 793
- 1
- 8
- 13
0
votes
1 answer
switch subtree to different remote branch
Consider this part of a repository of mine:
/
myproject
django -> django/master (django/django @github)
... other dependencies
django is a subtree that I merged following this howto: How to use the subtree merge strategy
Now I found out that…

tback
- 11,138
- 7
- 47
- 71
0
votes
2 answers
Hbase and distributed prefix tree
I would like to represent and store a huge list of sequences as a prefix tree in many machines as follows:
+A master machine will represent prefixes of sequences.
+n slaves machines will represent n sub-prefix trees with each contains the rest of…

Tran Ho
- 1,442
- 9
- 15
0
votes
1 answer
Count number of nodes in subtree
I have a tree and I have to return a copy of the tree with each node set with the number of nodes in the left subtree and the right subtree
this is the tree structure
izq means left and der means right

AlanRubinoff
- 385
- 9
- 30
0
votes
3 answers
Get all treepaths of a Tree as String
I'm searching now a while for a method, which gave me all path of a given tree. Imagine the following Tree:
A
B
C
D
E
F
G
Now I want to get all path as separate String:
AB
ACDE
ACF
AG
---------------Update-----------------
As…

ph09
- 1,052
- 2
- 20
- 31
0
votes
2 answers
Binary Search Tree Scheme
My friend and I are currently working on creating a Binary Search Tree in Scheme. We cannot get it to save what we have inserted. My professor said we are to use set-car! (cdr ( for the left subtree somehow, but I don't know where exactly to put…

Jared
- 391
- 2
- 6
- 14
0
votes
2 answers
Haskell: return a list of all substrees in Binary Tree. Is my code correct?
So I am trying to implement a functoin in Haskell that accepts a Binary Tree and returns a list of all subtrees where order and repetition does not matter but all substrees must be present at least once. Here is my code:
data BinTree a = Empty |…

Georgi Angelov
- 4,338
- 12
- 67
- 96
0
votes
1 answer
Is This Statement True (Used to Determine If a Tree is a SubTree of Another)
I have two binary trees T1 and T2, and they are both character trees, which means:
struct TreeNode
{
char data;
TreeNode* left;
TreeNode* right;
TreeNode(const char d, TreeNode* const lptr = NULL,
…

Peter Lee
- 12,931
- 11
- 73
- 100
0
votes
0 answers
svn merging of a subtree, then the full tree
In my company we use SVN to merge subtrees of the trunk into the branches and vice versa.
For example, we merge /Trunk/folderA/ --> /Branch/folderA/ and not always perform the root merge from /Trunk/ --> /Branch/.
I noticed that the mergeinfo of…

Ohn
- 51
- 4
0
votes
2 answers
RAILS: How to generate links for Grandchild Model using [@Grandparent, @Parent] notation (Grandparent shows as Nil)
I'm running across the following error when I try to show, edit, delete, or add a district:
undefined method `state_path' for #<#:0x007f93af11f8d8>
I'm expecting for it to generate a country_state_path link since I have…

Phillip Boushy
- 445
- 1
- 4
- 14
0
votes
1 answer
How to find the height of the left and right subtree in C#
How to find the subtree height both left and right, I have used this code in the following link
C# BST
Any help would be appreciated.
Kind Regards

Jacob Martin
- 3
- 2
0
votes
4 answers
If one binary tree is the subtree of another tree
I wrote this function to check if n2 is the subtree of n1. I use recursion, but when I tested it using two trees, it showed me the wrong answer (expected true, but it actually returned false).
I struggled for a while but still cannot say what's…

Emma
- 1
- 1
0
votes
1 answer
Git: Merge a range of local commits on to subtree branch
I've made some changes to an upstream project in my local repository. I originally plain copied the upstream repo into my local project. Now I'd like to grab a range of commits and apply it to the upstream repo. I could do this with a patch, but I…

Dane O'Connor
- 75,180
- 37
- 119
- 173
0
votes
1 answer
"cracking the coding interview(fourth edition)": 4.7 subtree checking
You have two very large trees: T1, with millions of nodes, and T2,
with hundreds of nodes. Create an algorithm to decide if T2 is a
subtree of T1
The author gives a brute force search solution, just do comparison
one node by one node. The…

Fihop
- 3,127
- 9
- 42
- 65