Pth cousins question

Правка en1, от Arunnsit, 2016-03-25 16:55:17

hello guys , so i was trying to solve a question and came up with this one.

Given a tree with N nodes , you need to find the number of Pth cousins . where a Pth cousin is defined as a pair of nodes x,y and there exists a node z which is Pth ancestor of both x and y . you need to print an array of n integers each denoting the count of ith cousins , where 1<=i<=n .

1<n<=100000

Теги trees, lca

История

 
 
 
 
Правки
 
 
  Rev. Язык Кто Когда Δ Комментарий
en1 Английский Arunnsit 2016-03-25 16:55:17 405 Initial revision (published)