New answers tagged trees
0
votes
NP-hardness of modified distance-colouring of graphs
The problem you describe (for $r=1$) falls under the so-called $[\sigma,\rho]$-partitioning framework with several hardness results available (see e.g., [1]). In such a problem, we want to color the ...
0
votes
Trying to implement BFS and I am stuck
Every tree is also a graph. Therefore, you can use breadth-first search directly on a tree. It doesn't require recursion; you can use a queue and a loop. As soon as you encounter a node that ...

D.W.♦
- 156k
0
votes
NP-hardness of modified distance-colouring of graphs
I don't have an answer to your problem, but I have an answer for a different problem.
Let the Annotated Colorful Neighborhood-problem be as follows.
Annotated 2-Colorful 1-Neighborhood
Input: $G = (V, ...
0
votes
Trying to implement BFS and I am stuck
The pseudo code for DFS using recursion would look something like this:
...
0
votes
fastest algorithm to count leaf nodes (i.e. terminal nodes)
Store the tree in an array $A$ so that $A_i$ contains the index of the
parent's node. For example:
A = [-1 0 1 1]
would be a four-node-tree where the root node has ...
Top 50 recent answers are included
Related Tags
trees × 840algorithms × 323
graphs × 256
data-structures × 222
binary-trees × 127
search-trees × 50
graph-traversal × 48
search-algorithms × 30
optimization × 29
combinatorics × 27
time-complexity × 26
recursion × 26
terminology × 24
dynamic-programming × 24
algorithm-analysis × 23
balanced-search-trees × 22
minimum-spanning-tree × 20
complexity-theory × 19
binary-search-trees × 19
heaps × 17
shortest-path × 16
spanning-trees × 15
discrete-mathematics × 14
counting × 11
reference-request × 10