RMQ
关系。首先我们先回顾一下不使用RMQ来解决LCA的两个简单方法;然后我们将指出RMQ和LCA问题其实是等价的;并且,最后,我们将看到RMQ问题怎样规约成它的限制版本,并且对于这个特殊情况给出一个最快的算法。
Notations
假设一个算法预处理时间为 f(n),查询时间为g(n)。这个算法复杂度的标记为<f(n), g(n)>。我们将用RMQA(i, j)来表示数组中索引i和j之间最小值的位置。 u和v的离树T根结点最远的公共祖先用LCAT(u, v)表示。
Range Minimum Query(RMQ)
给定数组A[0, N-1]找出给定的两个索引间的最小值的位置。

Trivial algorithms for RMQ
对每一对索引(i, j),将RMQA(i, j)存储在M[0, N-1][0, N-1]表中。普通的计算将得到一个<O(N3), O(1)> 复杂度的算法。尽管如此,通过使用一个简单的动态规划方法,我们可以将复杂度降低到<O(N2), O(1)>。预处理的函数和下面差不多:

Range Minimum Query and Lowest Common Ancestor By danielp TopCoder Member Introduction Notations Range Minimum Query (RMQ) Trivial algorithms for RMQ A <O...
Topcoder 上有一篇详细阐述 RMQ 问题的“ Range Minimum Query and Lowest Common Ancestor ”,网上也有翻译版。在此,我来简单引用 & 总结下。至于为何要总结 ...
The lowest common ancestor is defined between two nodes v and w as the ... Range Minimum Query an... 23页 1下载券 Range Minimum Query an... ...
RMQ:Range Minimum Maximum Query – 在一个序列上,给定区间,求区间极值 ? LCA:Lowest Common Ancestor – 最近公共祖先是一个节点,是指定两点的祖先, 且深度...
(smallest lowest common ancestor) problem, and ...Query instances of XQuery FT and XML IR/fragment...Structural join of XML based on range partitioning...
(smallest lowest common ancestor); dewey encoding;...Query instances of XQuery FT and XML IR/fragment...Structural join of XML based on range partitioning...
lca = lowest common ancestor ? u = lca(v,w): v と w の共通の祖先 ...5 6 7 8 9 10 11 u v mw 5 6 13 Range Minimum Query 问题 (RMQ) ...
Abstract. The Range-Minimum-Query-Problem is to preprocess an array such ...1 Introduction The problem of ?nding the lowest common ancestor (LCA) of ...
Key words:algorithm design; binary tree; inorder traversal; query fast 摘要...[18] Daniel P.Range minimum query and lowest common ancestor[EB/OL]. ...
// 与根结点U合并(并查集操作) Find(u).ancestor?:=?u?? // 将u所在...57、P94? ②《Range? Minimum? Query? and? Lowest? Common? Ancestor》by?...
热门文档