Top | MCQs on Graph Data Strcuture with Answers | Question 35
Which of the following operations can be efficiently performed using a segment tree?
(A)
Finding the longest increasing subsequence in a given range
(B)
Finding the most frequent element in a given range
(C)
Finding the number of inversions in a given range
(D)
Finding the top K elements in a given range
Answer: (C)
Explanation:
A segment tree can efficiently find the number of inversions in a given range by performing a modified merge sort algorithm.
Quiz of this Question
Please comment below if you find anything wrong in the above post
Last Updated :
23 May, 2023
Like Article
Save Article
Share your thoughts in the comments
Please Login to comment...