New answers tagged


An O(n)-time algorithm for the problem has been published by Gabow et al. (1984) in the context of "Cartesian trees": As pointed out above by Raphael, there is a close relationship to treaps. You may also want to visit the corresponding Wikipedia entry:

Top 50 recent answers are included