lec08

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

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

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 g ( n ) , f ( n ) . The following algorithms are taken from the set found in a paper from Bender and Farach-Colton[1].

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

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

### What students are saying

• As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

Kiran Temple University Fox School of Business ‘17, Course Hero Intern

• I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

Dana University of Pennsylvania ‘17, Course Hero Intern

• The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

Jill Tulane University ‘16, Course Hero Intern