Questions tagged [trees]

For questions about trees in graph theory, which are connected graphs with no cycles. Also can be used for questions about forests, which are graphs that are disjoint unions of trees.

Trees are an important topic in graph theory. A tree is a connected graph with no cycles. They are of enormous practical importance in applied mathematics.

For example, in a connected weighted graph, it is interesting to know how to find a subgraph which is a tree and which maximizes or minimizes the total weight of the subgraph. A subgraph of a graph $G$ which is a tree that touches all nodes of $G$ is called a spanning tree for $G$.

For instance, imagine a network of electrical systems, such as a telephone system, between nodes. Suppose that signals can travel through any path in the network, passing through intervening nodes to get to the final destination. The amount of wiring can be reduced by deleting portions of cycles in the graph of the network. The graph can eventually be reduced to a tree, and all nodes remain connected and accessible through the network.

Dijkstra's algorithm is an effective way to determine the lowest-weight spanning tree for a given connected graph.

2015 questions
1
vote
1 answer

Leftish Heap and Its Right Spine

Purely Functional Data Strutures presents the following question: Chapter 3, Question 1: "Prove that the right spine of a leftist heap of size n contains, at most, floor ( log ( n + 1) ) elements." Earlier in the chapter, it explains: "Leftish…
1
vote
1 answer

Maximum number of distinct binary tree possible with 4 nodes

what is the maximum number of distinct binary tree is possible with 4 nodes? ans is 6 but how? acc to me it should be 14
Ashish
  • 151
0
votes
1 answer

Formula for number of "root" nodes in a tree where Parent shares child nodes?

If I have a tree like this: {a},{b,c},{d,e,f},{g,h,i,j} in this case we have a total of 10 nodes. Is there any equation where given "10" I can calculate how many bottom nodes there are (answer: "4" in my example)?
0
votes
2 answers

Determine the minimum number of weighings to find the counterfeit coin.

Here's the full problem: We have 20 coins, 1 of which is counterfeit (too light). Determine the minimum number of weighings to find the counterfeit coin. Okay so is used the formula $$h=\left \lceil{\log_ml}\right \rceil,$$ with $m=3$ and $l=20$.…
user30625
  • 707
0
votes
0 answers

Measuring values at nodes of two independent but now connected trees

I am not sure if this the right forum for this question and I hope I am providing enough details on what I want to accomplish. I have an application that has multiple trees - Tree 1 - is categories/ attributes/ attribute values There is a weight on…
0
votes
0 answers

Proper definition of a full tree

When I've searched up online mostly I found the definition for full trees to be limited to a tree which has 0 or 2 children for each of it's nodes. Which is okay to understand but here is my dilemma. Most of the examples of full tree shows that the…
0
votes
0 answers

Deletion in AVL trees

assuming that one has to delete the root of an AVL tree. Does it matter which node replaces the root, say if it is the next smaller or next greater number than the root itself, as long as the AVL-property is satisfied and the tree is balanced?
Ozk
  • 429
  • 2
  • 10
0
votes
0 answers

Is this binary tree (constructed from inorder and preorder traversal) possible?

The problem gives the following in-order and pre-order traversal of a binary tree: In-order: 10 20 30 40 50 60 70 80 Pre-order: 40 50 20 80 30 70 60 10 I am supposed to construct the binary tree that would produce these traversals. I have tried to…
0
votes
0 answers

Figuring out the Most number of levels in a Binary tree.

If we were given a specific number like 15, what approach can we use to determine the Maximum number of levels that can be present in a binary tree ?
0
votes
1 answer

Unique solution for a given pre- and post-order of a rooted tree

Decide the picture of a rooted tree with pre-order $a,b,c,d,e,f,g,h$ and post-order $d,e,f,g,h,c,b,a$. Show that there always is a unique solution for a given pre- and post-order of a rooted tree. My solution is: a / …
0
votes
1 answer

Tree with infinite levels without infinite path

I'm trying to wrap my head around the concept of an infinite tree with infinite, no empty levels (so each level n of |N contains at least 1 node), and no restriction on the amount of neighbours, but no infinite paths. My main contention is that the…
0
votes
1 answer

Getting a values from nodes

The goal: get horizontal values of vertical level N where level 1 is pinacle node (1). Example: level 4 as input should produce: | 1 | 3 | 3 | 1 | Note: the sum of two adjacent nodes of level N is the value of node of level N + 1 in between those…
0
votes
1 answer

Minimal Red-Black tree with depth 3

I'd like to ask what is minimal RBT with black depth 3. Is this following RBT ? Values are not important. And that tree can't have depth 2 or 1.
Noturab
  • 497
0
votes
2 answers

Prove there is a tree with $n$ vertices having degrees $d_1, d_2....d_n$

For $n ≥ 2$ suppose $d_1, d_2,....d_n$ are positive integers with sum $2n - 2$. Prove there is a tree with n vertices having degrees $d_1, d_2....d_n$. I'm at a loss on this one. I'm sure it's pretty simple but I just can't get it.
0
votes
1 answer

Counting leaf nodes from tree instructions

A tree with degree 7 has 7 nodes with degree 2, 6 nodes with degree 3, 5 nodes with degree 4, 4 nodes with degree 5, 3 nodes with degree 6, and 2 nodes with degree 7. How many leaf nodes does the tree have? a) 35 b) 28 c) 77 d) 78 By doing it the…