lec08 - 6.851 Advanced Data Structures Spring 2010 Lecture...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
6.851: Advanced Data Structures Spring 2010 Lecture 8 — March 2, 2010 Prof. Erik Demaine Scribe: Andrew Winslow 1 Overview In the last lecture we studied suffix trees and suffix arrays. These two data structures are useful for answering a variety of queries on strings such as string matching, string frequency and longest repeating substring. They offer advantages over more generic data structures like binary search trees and hashes. We learned that a linear-time algorithm exists for converting between suffix trees and suffix arrays, and that there exists an algorithm for efficiently constructing suffix arrays, the DC3 algorithm. Finally, we studied a modification to suffix arrays that allows one to perform document retrieval queries in O ( | P | + d ) time, where P is the pattern to search a set of documents for and d is the number of documents containing P . In today’s lecture two problems are discussed: Level Ancestor Query (LAQ) and Least Common Ancestor (LCA). LAQ will be covered fully today, while LCA will be completed next lecture. Both problems have the same setting: given a rooted tree T and a node v , find an ancestor of v with some property. For LAQ, we will study various approaches with different preprocessing and query times, culminating in a data structure with O ( n ) preprocessing and O (1) query time. For LCA, we will study a different but related problem (Range Minimum Query or RMQ) which will help us to solve LCA. 2 Least Ancestor Queries (LAQ) First we introduce notation. Let h ( v ) be the height of a node v in a tree. Given a node v and level l , LAQ ( v,l ) is the ancestor a of v such that h ( a ) - h ( v ) = l . Today we will study a variety of data structures with various preprocessing and query times which answer LAQ ( v,l ) queries. For a data structure which requires f ( n ) query time and g ( n ) preprocessing time, we will denote its running time as h g ( n ) ,f ( n ) i . The following algorithms are taken from the set found in a paper from Bender and Farach-Colton[1].
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 01/20/2012 for the course CS 6.849 taught by Professor Erikdemaine during the Fall '10 term at MIT.

Page1 / 4

lec08 - 6.851 Advanced Data Structures Spring 2010 Lecture...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online