Chapter 7 Data Structure Transformations Basheer Qolomany.

Slides:



Advertisements
Similar presentations
Planar point location -- example
Advertisements

Orthogonal range searching. The problem (1-D) Given a set of points S on the line, preprocess them to build structure that allows efficient queries of.
 Definition of B+ tree  How to create B+ tree  How to search for record  How to delete and insert a data.
1 AVL-Trees (Adelson-Velskii & Landis, 1962) In normal search trees, the complexity of find, insert and delete operations in search trees is in the worst.
Dynamic Planar Convex Hull Operations in Near- Logarithmic Amortized Time TIMOTHY M. CHAN.
I/O-Algorithms Lars Arge Fall 2014 September 25, 2014.
1 Persistent data structures. 2 Ephemeral: A modification destroys the version which we modify. Persistent: Modifications are nondestructive. Each modification.
©Silberschatz, Korth and Sudarshan12.1Database System Concepts Chapter 12: Part C Part A:  Index Definition in SQL  Ordered Indices  Index Sequential.
Quick Review of Apr 10 material B+-Tree File Organization –similar to B+-tree index –leaf nodes store records, not pointers to records stored in an original.
©Silberschatz, Korth and Sudarshan12.1Database System Concepts Chapter 12: Indexing and Hashing Basic Concepts Ordered Indices B+-Tree Index Files B-Tree.
CS Section 600 CS Section 002 Dr. Angela Guercio Spring 2010.
B+-Trees (PART 1) What is a B+ tree? Why B+ trees? Searching a B+ tree
1 Algorithmic Aspects of Searching in the Past Christine Kupich Institut für Informatik, Universität Freiburg Lecture 1: Persistent Data Structures Advanced.
Outline Scapegoat Trees ( O(log n) amortized time)
Week 5 - Associative Containers: sets and maps. 2 2 Main Index Main Index Content s Content s Container Types Sequence Containers Adapter Containers Associative.
Multiversion Access Methods - Temporal Indexing. Basics A data structure is called : Ephemeral: updates create a new version and the old version cannot.
Binary Search Trees CIS 606 Spring Search trees Data structures that support many dynamic-set operations. – Can be used as both a dictionary and.
Persistent Data Structures Computational Geometry, WS 2007/08 Lecture 12 Prof. Dr. Thomas Ottmann Khaireel A. Mohamed Algorithmen & Datenstrukturen, Institut.
Temporal Indexing MVBT. Temporal Indexing Transaction time databases : update the last version, query all versions Queries: “Find all employees that worked.
Temporal Indexing MVBT. Temporal Indexing Transaction time databases : update the last version, query all versions Queries: “Find all employees that worked.
I/O-Algorithms Lars Arge Spring 2009 March 3, 2009.
Amortized Rigidness in Dynamic Cartesian Trees Iwona Białynicka-Birula and Roberto Grossi Università di Pisa STACS 2006.
I/O-Efficient Structures for Orthogonal Range Max and Stabbing Max Queries Second Year Project Presentation Ke Yi Advisor: Lars Arge Committee: Pankaj.
Point Location Computational Geometry, WS 2007/08 Lecture 5 Prof. Dr. Thomas Ottmann Algorithmen & Datenstrukturen, Institut für Informatik Fakultät für.
© 2006 Pearson Addison-Wesley. All rights reserved12 A-1 Chapter 12 Heaps.
1 Geometric index structures April 15, 2004 Based on GUW Chapter , [Arge01] Sections 1, 2.1 (persistent B- trees), 3-4 (static versions.
Andreas Klappenecker [based on the slides of Prof. Welch]
Tirgul 6 B-Trees – Another kind of balanced trees Problem set 1 - some solutions.
1 Persistent data structures. 2 Ephemeral: A modification destroys the version which we modify. Persistent: Modifications are nondestructive. Each modification.
5.9 Heaps of optimal complexity
David Luebke 1 7/2/2015 Medians and Order Statistics Structures for Dynamic Sets.
Recursion Chapter 7. Chapter 7: Recursion2 Chapter Objectives To understand how to think recursively To learn how to trace a recursive method To learn.
Skip Lists1 Skip Lists William Pugh: ” Skip Lists: A Probabilistic Alternative to Balanced Trees ”, 1990  S0S0 S1S1 S2S2 S3S3 
Recursion Chapter 7. Chapter 7: Recursion2 Chapter Objectives To understand how to think recursively To learn how to trace a recursive method To learn.
Binary search trees Definition Binary search trees and dynamic set operations Balanced binary search trees –Tree rotations –Red-black trees Move to front.
B-Trees (continued) Analysis of worst-case and average number of disk accesses for an insert. Delete and analysis. Structure for B-tree node.
Chapter Tow Search Trees BY HUSSEIN SALIM QASIM WESAM HRBI FADHEEL CS 6310 ADVANCE DATA STRUCTURE AND ALGORITHM DR. ELISE DE DONCKER 1.
9/17/20151 Chapter 12 - Heaps. 9/17/20152 Introduction ► Heaps are largely about priority queues. ► They are an alternative data structure to implementing.
Recursion Chapter 7. Chapter Objectives  To understand how to think recursively  To learn how to trace a recursive method  To learn how to write recursive.
Chapter 3 Sec 3.3 With Question/Answer Animations 1.
1 B-Trees & (a,b)-Trees CS 6310: Advanced Data Structures Western Michigan University Presented by: Lawrence Kalisz.
Chapter 11 Heap. Overview ● The heap is a special type of binary tree. ● It may be used either as a priority queue or as a tool for sorting.
Mehdi Mohammadi March Western Michigan University Department of Computer Science CS Advanced Data Structure.
B + -Trees Same structure as B-trees. Dictionary pairs are in leaves only. Leaves form a doubly-linked list. Remaining nodes have following structure:
Chapter 16 Recovery Yonsei University 1 st Semester, 2015 Sanghyun Park.
B + -Trees. Motivation An AVL tree with N nodes is an excellent data structure for searching, indexing, etc. The Big-Oh analysis shows that most operations.
CSC 221: Recursion. Recursion: Definition Function that solves a problem by relying on itself to compute the correct solution for a smaller version of.
1 Trees 4: AVL Trees Section 4.4. Motivation When building a binary search tree, what type of trees would we like? Example: 3, 5, 8, 20, 18, 13, 22 2.
File Organization and Processing Week Tree Tree.
2-3 Trees Extended tree.  Tree in which all empty subtrees are replaced by new nodes that are called external nodes.  Original nodes are called internal.
Open Problem: Dynamic Planar Nearest Neighbors CSCE 620 Problem 63 from the Open Problems Project
Linked List. Iterators Operation to find a link, deleting, and inserting before or after a specified link, also involve searching through the list to.
B-Tree – Delete Delete 3. Delete 8. Delete
Chapter 18: Searching and Sorting Algorithms. Objectives In this chapter, you will: Learn the various search algorithms Implement sequential and binary.
Skip Lists 二○一七年四月二十五日
Review for Exam 2 Topics covered (since exam 1): –Splay Tree –K-D Trees –RB Tree –Priority Queue and Binary Heap –B-Tree For each of these data structures.
Hashing 1 Hashing. Hashing 2 Hashing … * Again, a (dynamic) set of elements in which we do ‘search’, ‘insert’, and ‘delete’ n Linear ones: lists, stacks,
Chapter 15 A External Methods. © 2004 Pearson Addison-Wesley. All rights reserved 15 A-2 A Look At External Storage External storage –Exists beyond the.
Binary Search Trees (BSTs) 18 February Binary Search Tree (BST) An important special kind of binary tree is the BST Each node stores some information.
Lecture 9COMPSCI.220.FS.T Lower Bound for Sorting Complexity Each algorithm that sorts by comparing only pairs of elements must use at least 
Temporal Indexing MVBT. Temporal Indexing Transaction time databases : update the last version, query all versions Queries: “Find all employees that worked.
Database Applications (15-415) DBMS Internals- Part III Lecture 13, March 06, 2016 Mohammad Hammoud.
Andreas Klappenecker [partially based on the slides of Prof. Welch]
Topics covered (since exam 1):
Temporal Indexing MVBT.
Temporal Indexing MVBT.
Database Applications (15-415) DBMS Internals- Part III Lecture 15, March 11, 2018 Mohammad Hammoud.
Topics covered (since exam 1):
Chapter 14: Augmenting Data Structures
Topics covered (since exam 1):
Presentation transcript:

Chapter 7 Data Structure Transformations Basheer Qolomany

Outline 7.1 Making Structures Dynamic 7.2 Making Structures Persistent

7.1 Making Structures Dynamic Two types of data structures for solving searching problems: – A static structure is built once and then searched many times; insertions and deletions of elements are not allowed. – dynamic structure: This structure is initially empty, and the three operations available on it are for inserting a new element, for deleting a current element, and for performing a search.

Static & Dynamic Structures To describe the performance of the static structure A we give three functions of N : – P A (N) = the preprocessing time required to build A, – Q A (N) = the query time required to perform a search in A, and – S A (N) = the storage required to represent A. We analyze the performance of the dynamic structure B by giving the functions – I B ( N ) = the insertion time for B, – D B (N) = the deletion time for B, – Q B (N) = the query time required to perform a search in B, and – S B (N) = the storage required to represent B.

The Transformations The two well-studied problems here are how to make a static structure dynamic and how to allow queries in old states of a dynamic data structure. Static structures, like the interval trees: they are built once and then allow queries, but no changes of the underlying data. To make them dynamic, we want to allow changes in the underlying data. There are efficient construction methods that take the static data structure as a black box, which is used to build the new dynamic structure.The most important such class is the decomposable searching problems.

decomposable searching problems The notion of decomposable search problems, and the idea of a static-to-dynamic transformation, goes back to Bentley (1979). The underlying idea is always that the current set is partitioned in a number of blocks X = X 1 ∪ · · · ∪ X m. Each block is stored by one static structure; queries are answered by querying each of these static structures, and updates are performed by rebuilding one or several blocks.

decomposable searching problems The original method in Bentley (1979) uses only blocks whose size is a power of two, and only one block of each size. Thus there are at most log n blocks. This gives a bad worst-case complexity because we might have to rebuild everything into one structure; but the structure of size 2 i is rebuilt only when the ith bit of n changes, which is every 2 i−1 th step.

Insertion

If preproc(k) is the time to build a static structure of size k, then the total time of the first n inserts is: Thus the amortized insertion time in a set of n elements is

Theorem Given a static structure for a decomposable searching problem that can be built in time O (n(log n) c ) and that answers queries in time O(log n) for an n-element set, the exponential-blocks transformation gives a structure for the same problem that supports insertion in amortized O((log n) c+1 ) time and queries in worst-case O((log n) 2 ) time.

This method is not useful for deletion; if we delete an element from the largest block, we have to rebuild everything, so we can easily construct a sequence of alternating insert and delete operations, in which each time the entire structure has to be rebuilt. A method that also supports deletion partitions the set in Θ(√n) blocks of size O(√n).

Theorem Given a static structure for a decomposable searching problem that can be built in time O (n(log n) c ) and that answers queries in time O(log n) for an n-element set, the √n-blocks transformation gives a structure for the same problem that supports insertion and deletion in O(√n(log n) c ) time and queries in O(√n log n) time, all times worst case.

Weak deletion A weak deletion deletes the element, so that the queries are answered correctly, but the time bound for subsequent queries and weak deletions does not decrease. If we combine the weak deletion with the exponential- blocks idea, we get the following structure: The current set is partitioned into blocks, where each block has a nominal size and an actual size. The nominal size is a power of 2, with each power occurring at most once. The actual size of a block with nominal size 2 i is between 2 i−1 + 1 and 2 i.

To delete an element, we find its block and perform a weak deletion, decreasing the actual size. If by this the actual size of the block becomes 2 i−1, we check whether there is a block of nominal size 2 i−1 ; if there is none, we rebuild the block of actual size 2 i−1 as block of nominal size 2 i−1. Else, we rebuild the block of actual size 2 i−1 together with the elements of the block of nominal size 2 i−1 as block of nominal size 2 i. To insert an element, we create a block of size 1 and perform the binary addition of the blocks, based on their nominal size. To query, we perform the query for each block.

Theorem Given a static structure for a decomposable searching problem that can be built in time preproc(n) and that supports weak deletion in time weakdel(n), and answers queries in time query(n) for an n-element set, the exponential-blocks transformation with weak deletion gives a structure for the same problem that supports insertion in amortized O((log n) preproc(n)/n ) time, deletions in amortized O(weakdel(n) + preproc(n)/n ) time, and queries in worst-case O(log n query(n)) time.

7.2 Making Structures Persistent A dynamic data structure changes over time, and sometimes it is useful if we can access old versions of it. Obvious application is revision control and the implementation of the “undo” command in editors, multiple file versions, and error recovery. For example, given a database containing a company's personnel administration, it might be important to be able to ask questions like: how many people had a salary >= x one year ago. To answer this kind of so-called in-the-past queries, we require that the data structure can remember relevant information concerning its own history.

Techniques to access earlier versions “Partial persistence” The most natural persistence, allows queries to previous versions, which could be identified by timestamps or version numbers. “Full persistence” in which past versions can also be changed, giving rise to a version tree without any special current version. “Confluent persistence” studied first for double-ended queues, in a confluently persistent structure, one may also join different versions. But these stronger variants of persistence seem only of theoretical interest. “Backtracking”: setting the current version back to an old version and discarding all changes since then. The use of a stack for old versions predates all persistence considerations.

Fat nodes “Fat nodes” method is a transformation that replaces each node of the pointer-based structure by a search tree for the correct version of the node, using the query time as key. Each time the underlying structure is modified, any “fat” node whose content is modified just receives a new version entry in its search tree; and newly created nodes contain new search trees, initially with one version only.

Theorem Any dynamic structure in the pointer-machine model that supports queries in time query(n) and updates in time update(n) on a set with n elements can be made persistent, allowing queries to past versions, with a query time O(log n query(n)) for past versions, O(query(n)) for the current version, and update time O(update(n)), using the “fat nodes” method combined with a search tree that allows constant-time queries and updates at the maximum end.

Theorem Any dynamic structure in the pointer-machine model that supports queries in time query(n) and updates in time update(n) on a set with n elements can be made to support backtracking, using stacks for “fat nodes,” with a query time O(query(n)), update time O(update(n)), and backtrack time amortized O(1), with a sequence of a updates, b queries, and c backtracks, starting on an initially empty set, taking O(a update(a) + b query(a) + c).

Thank You