+1 vote
in Data Structures & Algorithms I by (110k points)
Cartesian trees solve range minimum query problem in constant time.

(a) true

(b) false

The above asked question is from Cartesian Tree topic in section Binary Trees of Data Structures & Algorithms I

This question was addressed to me during an internship interview.

1 Answer

+1 vote
by (672k points)
selected by
 
Best answer
The correct answer is (a) true

The explanation is: Range minmum query is finding the minimum element in a given subarray of an array. Constant time is achieved by storing the Cartesian trees for all the blocks in the array. Rmq’s are used in string matchings, computing lowest common ancestor and longest common prefix of a sring.

Related questions

Welcome to TalkJarvis QnA, a question-answer community website for the people by the people. On TalkJarvis QnA you can ask your doubts, curiosity, questions and whatever going in your mind either related to studies or others. Experts and people from different fields will answer.

Categories

...