Find number of ancestors whose weight is greater than given query and node

Revision en1, by rpthegreat, 2017-08-18 11:48:47

Hello, Given a tree (nodes and their weight) and query which contains two number node (of tree guaranteed )and value c . I need to find number of ancestors which has weight greater than c. I saved query and sorted according to their query value. I stored graph node and their respective weight in 2-D array and sorted according to their weight. I set bit array initially all zero and start visiting query array from last. Now how to use segment tree for query. Do i need to use another concept ? please help me . Thank you.

Tags segment tree, sorting, offline query

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en1 English rpthegreat 2017-08-18 11:48:47 617 Initial revision (published)