Skip to main content

Questions tagged [trees]

Questions about a special kind of graphs, namely connected and cycle-free ones.

1 vote
1 answer
149 views

Suppose you have this tree: 0 / \ 1 3 | | 2 4 / \ 5 6 With preorder-like ordering I mean the orderings where the father ...
lux_piromani's user avatar
0 votes
1 answer
77 views

I know that the number of different complete binary tree structures (unlabeled) for n nodes is basically 1, because the structure is fixed. Now I am trying to find the number of labeled complete ...
Dev Ops's user avatar
  • 91
1 vote
1 answer
72 views

If you have a tree, there are two common ways to select a random leaf node from the tree: You can "flatten" out the tree, so that each leaf node gets selected with the same probability. ...
WingedKnight's user avatar
1 vote
1 answer
61 views

Say that you have $n$ friends. They each have preference weights for each other. (e.g. the edge between Bob and Alice is 10 and the edge between Bob and Carl is 0.5, meaning that Bob likes/wants to ...
chausies's user avatar
  • 652
0 votes
0 answers
49 views

I'm trying to understand Gabow's LCA algorithm in (static) trees with $O(n)$ time preprocessing and $O(1)$ time queries (this is different from the popular Euler tour + RMQ approach). From what I ...
igel's user avatar
  • 111
0 votes
1 answer
58 views

by "augmentation" i mean adding an additional field to each node. All sources i found say something that falls into one of two categories: "A field f in a red-black tree can be ...
MathCat's user avatar
2 votes
1 answer
130 views

I found an algorithms/theory question that I'm having trouble with: Given a tree, delete nodes by compressing paths as follows: if node n is deleted, then the ...
MysticSwan's user avatar
1 vote
0 answers
39 views

I'm working with the NautyGraphs package in Macaulay2, and I use it to generate all the undirected trees with a fixed number of vertices. For instance: i23 : g = generateGraphs(10, OnlyTriangleFree =&...
user avatar
1 vote
1 answer
71 views

My understanding of directed cycles in a digraph $G$ is that it's is a non-empty trail $(v_1, v_2, ..., v_n)$ to some $v \in V$ to itself, where $V$ is the set of vertices. From this graph, I see 4 ...
user181566's user avatar
1 vote
1 answer
88 views

Edit: This problem came to our national level informatics competition and I can't find the original source Say we have two functions $g(u, v)$ and $d(u, v)$ for a tree with $N$ nodes and $N - 1$ edges....
Spirit's user avatar
  • 23
3 votes
0 answers
48 views

Let's define a Tree of Ints as: data Tree = Node Tree Tree | Leaf Int Let X be a source tree, and ...
MaiaVictor's user avatar
  • 4,219
1 vote
1 answer
78 views

Given a tree with $n$ vertices, with each vertex having sum number $a_i$, I want to find the number of pairs of vertices $1 \leq i < j \leq n$ where the path from vertex $i$ through vertex $j$ has ...
Samuel Kim's user avatar
2 votes
0 answers
64 views

In the Union-Find data structure (also known as the Disjoint-Set data structure), elements of a set have directed edges providing paths to the representative element, or root, of the set. Each set ...
Ellen Spertus's user avatar
0 votes
0 answers
74 views

I was reading a textbook (Competitive Programming 4 by Steven Halim) and it asked as an exercise to see if we could implement deletion on a Fenwick tree. The most clear solution (and easiest to ...
Ghost11's user avatar
1 vote
0 answers
44 views

I have a tree containing sum nodes, choice nodes and point nodes. I'd like to maximize the number of points at the root of the tree. The value you get for a point node is the number of points on that ...
danvk's user avatar
  • 111

15 30 50 per page
1
2 3 4 5
60