Imagine the following tree:
A
/ \\
B C
/ \\ \\
D E F
I\'m looking for a way to query if for example F is a descendant of A (n
In a pre-order traversal, every set of descendants is contiguous. For your example,
A B D E C F
+---------+ A
+---+ B
+ D
+ E
+-+ C
+ F
If you can preprocess, then all you need to do is number each node and compute the descendant interval.
If you can't preprocess, then a link/cut tree offers O(log n) performance for both updates and queries.