当前课程知识点:计算几何 > 07. Geometric Range Search > B. BBST > 07-B-02. Lowest Common Ancestor
现在我们就来看看
利用这样的一种形式的BBST
如何来解答我们刚才所说的
range query问题
虽然它还依然只是一维的情形
我们的输入作为一个典型的例子
不妨取作2 15
那么我们的查找过程
大致可以分为这样几步
首先我们要针对这个左端点2
来做一次二分查找
从这里出发
到7到3到1
最后落脚在1
不要忘了按照我们这个约定
区间的左边界是开的
所以严格的讲
第一个命中的元素应该是
刚才查找结果的后继
在这里来说
也就是这个3
接下来我们还需要针对
刚才指定的那个区间的右端点
也就是15
再做一次类似的查找
同样的从根结点16出发
到7到12到14
最终我们会落脚在14
因为按照语义
这个14是在全局中
不大于15的最大的那个元素
现在我们已经查到了3和14
这两个点
从逻辑结构来看
已经一目了然
所有那些命中
也就是位于这个区间
之内的那些元素
都应该是介于它们之间的这些点
无非如此
那么接下来
我们应该怎么把这些点
报告出来
怎么来高效的报告出来
为此我们需要关注到
一个特殊的元素
也就是这个元素
和这个查找到的元素
它们的那个最低的公共祖先
lowest common ancestor
我们简称为LCA
也就是这个
在这个例子而言的7
-Before we start
--html
-Evaluation
--html
-Online Judge
--html
-Lecture notes
--html
-Discussion
--html
-A. History of This Course
--00-A. History of This Course
-B. What's Computational Geometry
--00-B. What's Computational Geometry
-B. What's Computational Geometry--作业
-C. How to Learn CG Better
--00-C. How to Learn CG Better
-C. How to Learn CG Better--作业
-D. Why English
-A. Convexity
-A. Convexity--作业
-B. Extreme Points
-B. Extreme Points--作业
-C. Extreme Edges
-C. Extreme Edges--作业
-D. Incremental Construction
--01-D-01. Decrease and Conquer
--01-D-02. In-Convex-Polygon Test
--01-D-03. Why Not Binary Search
-D. Incremental Construction--作业
-E. Jarvis March
--01-E-06. Lowest-Then-Leftmost
-E. Jarvis March--作业
-F. Lower Bound
--01-F-02. CAO Chong's Methodology
-F. Lower Bound--作业
-G. Graham Scan: Algorithm
-G. Graham Scan: Algorithm--作业
-H. Graham Scan: Example
-H. Graham Scan: Example--作业
-I. Graham Scan: Correctness
-I. Graham Scan: Correctness--作业
-J. Graham Scan: Analysis
-J. Graham Scan: Analysis--作业
-K. Divide-And-Conquer (1)
-K. Divide-And-Conquer (1)--作业
-L. Divide-And-Conquer (2)
--01-L-03. Topmost + Bottommost ?
--01-L-07. More Considerations
-L. Divide-And-Conquer (2)--作业
-M. Wrap-Up
-0. Introduction
-0. Introduction--作业
-A. Preliminary
-A. Preliminary--作业
-B. Interval Intersection Detection
-B. Interval Intersection Detection--作业
-C. Segment Intersection Reporting
-C. Segment Intersection Reporting--作业
-D. BO Algorithm: Strategy
--02-D-01. Proximity & Separability
--02-D-02. Comparability & Ordering
-D. BO Algorithm: Strategy--作业
-E. BO Algorithm: Implementation
--02-E-03. Events & Operations
-E. BO Algorithm: Implementation--作业
-F. BO Algorithm: Analysis
--02-F-04. Complexity of Event Queue
--02-F-05. Complexity of Status Structure
-F. BO Algorithm: Analysis--作业
-G. Convex Polygon Intersection Detection
--02-G-01. Problem Specification
--02-G-02. Monotone Partitioning
--02-G-04. Decrease-And-Conquer
-G. Convex Polygon Intersection Detection--作业
-H. Edge Chasing
--02-H-01. Eliminating Sickles
-H. Edge Chasing--作业
-I. Plane Sweeping
-I. Plane Sweeping--作业
-J. Halfplane Intersection Construction
-J. Halfplane Intersection Construction--作业
-0. Methodology
-0. Methodology--作业
-A. Art Gallery Problem
--03-A-02. Lower & Upper Bounds
--03-A-04. Approximation & Classification
-A. Art Gallery Problem--作业
-B. Art Gallery Theorem
--03-B-01. Necessity of floor(n/3)
--03-B-02. Sufficiency by Fan Decomposition
-B. Art Gallery Theorem--作业
-C. Fisk's Proof
--03-C-04. Pigeon-Hole Principle
-C. Fisk's Proof--作业
-D. Orthogonal Polygons
--03-D-01. Necessity of floor(n/4)
--03-D-02. Sufficiency by Convex Quadrilateralization
-D. Orthogonal Polygons--作业
-E. Triangulation
-E. Triangulation--作业
-F. Triangulating Monotone Polygons
--03-F-02. Monotonicity Testing
--03-F-04. Stack-Chain Consistency
-F. Triangulating Monotone Polygons--作业
-G. Monotone Decomposition
-G. Monotone Decomposition--作业
-I. Tetrahedralization
--03-I-01. Polyhedron Decomposition
--03-I-02. Schonhardt's Polyhedron
-I. Tetrahedralization--作业
-A. Introduction
--04-A-02. Dining Halls on Campus
--04-A-03. More Analogies & Applications
-A. Introduction--作业
-B. Terminologies
--04-B-02. Intersecting Halfspaces
--04-B-04. Planar Voronoi Diagram
-B. Terminologies--作业
-C. Properties
--04-C-03. Nearest = Concyclic
--04-C-04. Number of Nearest Sites = Degree
-C. Properties--作业
-D. Complexity
-D. Complexity--作业
-E. Representation
-E. Representation--作业
-F. DCEL
-F. DCEL--作业
-G. Hardness
--04-G-03. Voronoi Diagram In General Position
-G. Hardness--作业
-H. Sorted Sets
--04-H-01. Convex Hull Made Easier
--04-H-02. Convex Hull As A Combinatorial Structure
--04-H-03. Voronoi Diagram As A Geometric Structure
-H. Sorted Sets--作业
-I. VD_sorted
--04-I-06. Sorting Not Made Easier
-I. VD_sorted--作业
-J. Naive Construction
-J. Naive Construction--作业
-K. Incremental Construction
-K. Incremental Construction--作业
-L. Divide-And-Conquer
--04-L-09. Intersecting with Cells
-L. Divide-And-Conquer--作业
-M. Plane-Sweep
--04-M-09. Circle Event: What, When & Where
-M. Plane-Sweep--作业
-A. Point Set Triangulation
-A. Point Set Triangulation--作业
-B. Delaunay Triangulation
-B. Delaunay Triangulation--作业
-C. Properties
-C. Properties--作业
-D. Proximity Graph
--05-D-02. Relative Neighborhood Graph
-D. Proximity Graph--作业
-E. Euclidean Minimum Spanning Tree
-E. Euclidean Minimum Spanning Tree--作业
-F. Euclidean Traveling Salesman Problem
-G. Minimum Weighted Triangulation
-G. Minimum Weighted Triangulation--作业
-H. Construction
--05-H-03. Maximizing The Minimum Angle
--05-H-04. Evolution By Edge Flipping
-H. Construction--作业
-I. RIC With Example
-I. RIC With Example--作业
-J. Randomized Incremental Construction
--05-J-01. Recursive Implementation
--05-J-02. Iterative Implementation
-J. Randomized Incremental Construction--作业
-K. RIC Analysis
--05-K-04. Types Of Edge Change
--05-K-05. Number Of Edge Changes
--05-K-07. Number Of Rebucketings
--05-K-08. Probability For Rebucketing
--05-K-10. Further Consideration
-0. Online/Offline Algorithms
--06-0. Online/Offline Algorithms
-0. Online/Offline Algorithms--作业
-A. Introduction
--06-A-03. Assumptions For Clarity
--06-A-05. Performance Measurements
-A. Introduction--作业
-B. Slab Method
--06-B-02. Ordering Trapezoids
-B. Slab Method--作业
-C. Persistence
--06-C-01. Ephemeral Structure
--06-C-02. Persistent Structure
-C. Persistence--作业
-D. Path Copying
--06-D-03. Storage Optimization
-D. Path Copying--作业
-E. Node Copying
-E. Node Copying--作业
-F. Limited Node Copying
-G. Kirkpatrick Structure
--06-G-01. Optimal And Simpler
--06-G-06. The More The Better
--06-G-07. The Fewer The Better
--06-G-09. Existence Of Independent Subset
--06-G-10. Construction Of Independent Subset
-G. Kirkpatrick Structure--作业
-H. Trapezoidal Map
--06-H-03. Properties & Complexity
--06-H-04. Search Structure: Example
--06-H-05. Search Structure: Nodes
--06-H-06. Search Structure: Performance
-H. Trapezoidal Map--作业
-I. Constructing Trapezoidal Map
--06-I-04. Case 1: Two Endpoints
--06-I-05. Case 2: One Endpoint
--06-I-06. Case 3: No Endpoints
-J. Performance Of Trapezoidal Map
--06-J-03. Number Of Ray Trimmed
--06-J-04. Number Of Trapezoidals Created (1)
--06-J-05. Number Of Trapezoidals Created (2)
--06-J-06. Time For Point Location
--06-J-07. Size Of Search Structure
--06-J-08. Fixed Query Point + Randomly Created Maps
--06-J-10. Probability Of Enclosing Trapezoid Changed
-A. Range Query
--07-A-01. 1-Dimensional Range Query
-A. Range Query--作业
-B. BBST
--07-B-02. Lowest Common Ancestor
-B. BBST--作业
-C. kd-Tree: Structure
-C. kd-Tree: Structure--作业
-D. kd-Tree: Algorithm
-D. kd-Tree: Algorithm--作业
-E. kd-Tree: Performance
--07-E-01. Preprocessing Time + Storage
-E. kd-Tree: Performance--作业
-F. Range Tree: Structure
--07-F-03. x-Query * y-Queries
-F. Range Tree: Structure--作业
-G. Range Tree: Query
-G. Range Tree: Query--作业
-H. Range Tree: Performance
-H. Range Tree: Performance--作业
-I. Range Tree: Optimization
--07-I-04. Fractional Cascading
-A. Orthogonal Windowing Query
-A. Orthogonal Windowing Query--作业
-B. Stabbing Query
-C. Interval Tree: Construction
-C. Interval Tree: Construction--作业
-D. Interval Tree: Query
-D. Interval Tree: Query--作业
-E. Stabbing With A Segment
--08-E-03. Query Algorithm (1)
--08-E-04. Query Algorithm (2)
-F. Grounded Range Query
--08-F-03. 1D-GRQ Using Range Tree
--08-F-04. 1D-GRQ By Linear Scan
-G. 1D-GRQ Using Heap
-G. 1D-GRQ Using Heap--作业
-H. Priority Search Tree
--08-H-03. Sibling Partitioning
-H. Priority Search Tree--作业
-I. 2D-GRQ Using PST
-I. 2D-GRQ Using PST--作业
-J. Segment Tree
--08-J-01. General Windowing Query
--08-J-02. Elementary Interval
--08-J-06. Solving Stabbing Query
--08-J-11. Constructing A Segment Tree
--08-J-12. Inserting A Segment (1)
--08-J-13. Inserting A Segment (2)
--08-J-14. Inserting A Segment (3)
-K. Vertical Segment Stabbing Query