Space Efficient and Output Sensitive Greedy Algorithms on Intervals Toshiki Saitoh (Kobe University) Joint work with ・ Takashi Horiyama (Saitama University)

Slides:



Advertisements
Similar presentations
Single Source Shortest Paths
Advertisements

COL 106 Shweta Agrawal and Amit Kumar
Heaps1 Part-D2 Heaps Heaps2 Recall Priority Queue ADT (§ 7.1.3) A priority queue stores a collection of entries Each entry is a pair (key, value)
AVL Trees1 Part-F2 AVL Trees v z. AVL Trees2 AVL Tree Definition (§ 9.2) AVL trees are balanced. An AVL Tree is a binary search tree such that.
© The McGraw-Hill Companies, Inc., Chapter 2 The Complexity of Algorithms and the Lower Bounds of Problems.
Liang, Introduction to Java Programming, Eighth Edition, (c) 2011 Pearson Education, Inc. All rights reserved Chapter 24 Sorting.
Advanced Topics in Algorithms and Data Structures 1 Rooting a tree For doing any tree computation, we need to know the parent p ( v ) for each node v.
Analysis of Algorithms CS 477/677 Instructor: Monica Nicolescu.
2 -1 Chapter 2 The Complexity of Algorithms and the Lower Bounds of Problems.
FALL 2004CENG 351 Data Management and File Structures1 External Sorting Reference: Chapter 8.
More sorting algorithms: Heap sort & Radix sort. Heap Data Structure and Heap Sort (Chapter 7.6)
FALL 2006CENG 351 Data Management and File Structures1 External Sorting.
© 2004 Goodrich, Tamassia Heaps © 2004 Goodrich, Tamassia Heaps2 Priority Queue Sorting (§ 8.1.4) We can use a priority queue to sort a set.
Priority Queues1 Part-D1 Priority Queues. Priority Queues2 Priority Queue ADT (§ 7.1.3) A priority queue stores a collection of entries Each entry is.
The Complexity of Algorithms and the Lower Bounds of Problems
PQ, binary heaps G.Kamberova, Algorithms Priority Queue ADT Binary Heaps Gerda Kamberova Department of Computer Science Hofstra University.
Heaps and heapsort COMP171 Fall 2005 Part 2. Sorting III / Slide 2 Heap: array implementation Is it a good idea to store arbitrary.
MergeSort Source: Gibbs & Tamassia. 2 MergeSort MergeSort is a divide and conquer method of sorting.
Priority Queues, Heaps & Leftist Trees
14/13/15 CMPS 3130/6130 Computational Geometry Spring 2015 Windowing Carola Wenk CMPS 3130/6130 Computational Geometry.
1 Trees A tree is a data structure used to represent different kinds of data and help solve a number of algorithmic problems Game trees (i.e., chess ),
Random Generation and Enumeration of Bipartite Permutation Graphs Toshiki Saitoh (JAIST, Japan) Yota Otachi (Gunma Univ., Japan) Katsuhisa Yamanaka (UEC,
The Binary Heap. Binary Heap Looks similar to a binary search tree BUT all the values stored in the subtree rooted at a node are greater than or equal.
MINATO ZDD Project Efficient Enumeration of the Directed Binary Perfect Phylogenies from Incomplete Data Toshiki Saitoh (ERATO) Joint work with Masashi.
Data Structure & Algorithm II.  Delete-min  Building a heap in O(n) time  Heap Sort.
Chapter 21 Binary Heap.
Computer Sciences Department1. Sorting algorithm 3 Chapter 6 3Computer Sciences Department Sorting algorithm 1  insertion sort Sorting algorithm 2.
Outline Priority Queues Binary Heaps Randomized Mergeable Heaps.
Sorting. Pseudocode of Insertion Sort Insertion Sort To sort array A[0..n-1], sort A[0..n-2] recursively and then insert A[n-1] in its proper place among.
Lars Arge Presented by Or Ozery. I/O Model Previously defined: N = # of elements in input M = # of elements that fit into memory B = # of elements per.
An experimental study of priority queues By Claus Jensen University of Copenhagen.
Priority Queue. Priority Queues Queue (FIFO). Priority queue. Deletion from a priority queue is determined by the element priority. Two kinds of priority.
Lectures on Greedy Algorithms and Dynamic Programming
Lecture 11COMPSCI.220.FS.T Balancing an AVLTree Two mirror-symmetric pairs of cases to rebalance the tree if after the insertion of a new key to.
+ David Kauchak cs312 Review. + Midterm Will be posted online this afternoon You will have 2 hours to take it watch your time! if you get stuck on a problem,
Priority Queues Two kinds of priority queues: Min priority queue. Max priority queue. Nov 4,
H EAPS. T WO KINDS OF HEAPS : MAX AND MIN Max: Every child is smaller than its parent Meaning the max is the root of the tree 10 / \ 9 7 / \ 6 8 / \ 2.
8 January Heap Sort CSE 2011 Winter Heap Sort Consider a priority queue with n items implemented by means of a heap  the space used is.
Interval S = [3,10]  {x | 3 ≤ x ≤ 10} Closed segment S = (3,10)  {x | 3 < x < 10} Opened segment S = [3,3]  {3} Point.
Week 15 – Wednesday.  What did we talk about last time?  Review up to Exam 1.
CS6045: Advanced Algorithms Sorting Algorithms. Heap Data Structure A heap (nearly complete binary tree) can be stored as an array A –Root of tree is.
Heaps © 2010 Goodrich, Tamassia. Heaps2 Priority Queue ADT  A priority queue (PQ) stores a collection of entries  Typically, an entry is a.
Week 13 - Wednesday.  What did we talk about last time?  NP-completeness.
Navigation Piles with Applications to Sorting, Priority Queues, and Priority Deques Jyrki Katajainen and Fabio Vitale Department of Computing, University.
Heaps, Heap Sort, and Priority Queues. Background: Binary Trees * Has a root at the topmost level * Each node has zero, one or two children * A node that.
UNC Chapel Hill M. C. Lin Geometric Data Structures Reading: Chapter 10 of the Textbook Driving Applications –Windowing Queries Related Application –Query.
Tries 07/28/16 11:04 Text Compression
Top 50 Data Structures Interview Questions
Priority Queues An abstract data type (ADT) Similar to a queue
Experimental evaluation of Navigation piles
The Greedy Method and Text Compression
Priority Queues © 2010 Goodrich, Tamassia Priority Queues 1
The Greedy Method and Text Compression
Heaps © 2010 Goodrich, Tamassia Heaps Heaps
Heaps 9/13/2018 3:17 PM Heaps Heaps.
Chapter 8 – Binary Search Tree
(2,4) Trees 11/15/2018 9:25 AM Sorting Lower Bound Sorting Lower Bound.
Part-D1 Priority Queues
© 2013 Goodrich, Tamassia, Goldwasser
(2,4) Trees 12/4/2018 1:20 PM Sorting Lower Bound Sorting Lower Bound.
Ch. 8 Priority Queues And Heaps
Heap Sort CSE 2011 Winter January 2019.
Priority Queues (Chapter 6.6):
Priority Queues An abstract data type (ADT) Similar to a queue
(2,4) Trees 2/28/2019 3:21 AM Sorting Lower Bound Sorting Lower Bound.
Priority Queues (Chapter 6):
Heaps & Multi-way Search Trees
Heaps 9/29/2019 5:43 PM Heaps Heaps.
CMPT 225 Lecture 16 – Heap Sort.
Presentation transcript:

Space Efficient and Output Sensitive Greedy Algorithms on Intervals Toshiki Saitoh (Kobe University) Joint work with ・ Takashi Horiyama (Saitama University) ・ David G. Kirkpatrick (UBC) ・ Yota Otachi (JAIST) ・ Ryuhei Uehara (JAIST) ・ Yushi Uno (Osaka Prefecture University) ・ Katsuhisa Yamanaka (Iwate University)

Background There are many big data We need to process big data, efficiently. Big data is too big! We cannot read the data at once. Polynomial space algorithms do not work! We have to consider machine models with space constraint

Machine Model with Space Constraint Streaming model Online algorithms Multi-pass algorithms Read-only random-access model Input: read-only and random-access media Workspace: random-access, but O(s) extra workspace (s<n) Output: write-only media There are many results for sorting and selection Time-space tradeoff We try to study more general problems!

Our Results Algorithms on Intervals Maximum independent set Minimum dominating set Connected dominating set Paired dominating set etc. These algorithms are Greedy Space efficient Memory adjustable priority queues [Asano et al. 2013] Output sensitive Running time depends on the output size To achieve output sensitiveness, we propose a new operation and its analysis This talk!

Maximum Independent Set on Intervals Independent set on intervals Set of intervals such that two distinct intervals do not intersect Maximum independent set problem on intervals Input: A set of intervals Output: Maximum cardinality independent set (unweighted) Independent set Maximum one

Algorithms (Known and Ours) TimeSpaceIdea Greedy O(n log n)O(n) wordsSorting Snoeyink [2004] O(n log k)O(n) words Divide and Conquer Bhattacharya et al. [2014] O(n’ (log s + n/s))O(s) wordsHeap Ours 1 O(n’ (log sk/n + n/s))O(s) wordsTournament Trees Ours 2 O(n’’ (log wsk/n + n/(ws))) O(s) words = O(ws) bits Navigation Piles Trigger Piles n: # input intervals, k: output size 1 word = w bits (w>log n) n’ = min{n, sk}, n’’ = min{n, wsk}

Greedy Algorithm 1. Sort the intervals according to their right and r = -∞ 2. While there exists a candidate do 3. Extract an interval I with minimum right 4. If l(I) > r then output I and set r = r(I) Input array (Read only) Sorting O(n) workspace r : the right of the last output interval

Workspace: O(s) words Min-heap H The size of the heap is O(s) Complete binary tree with s nodes Partition the input into s blocks At most one interval from each block is in the heap H Key: right endpoint Validity: Left endpoint is larger than r r is the right of the last output interval Each internal node has smaller element of its children … … …… … B1B1 B2B2 BsBs … Min-heap size O(s) Bhattacharya’s Algorithm (1)

… … …… … B1B1 B2B2 BsBs … r Min-heap size O(s) Bhattacharya’s Algorithm (2) 1. Initialize the heap H and r=-∞ 2. While H is not empty do 3. Pop an interval I with minimum right in H 4. if I does not contain r then 5. Output I and update r 6. Search a next interval J from the block which include I Next interval J has min-right such that l(J)>r 7. Push J into the heap H

Bhattacharya’s Algorithm (3) Computation time: O(min{n, sk}(log s+n/s)) Pop and Push operation: O(log s) time Search operation: O(n/s) time #while loop iterations: min {n, sk} n: Each element is pushed into the heap at most once sk: Output at least one element after s time loop … … …… … B1B1 B2B2 BsBs n/s Min-heap size O(s) … log s Redundant! 1. Initialize the heap H and r=-∞ 2. While H is not empty do 3. Pop an interval I with minimum right in H 4. if I does not contain r then 5. Output I and update r 6. Search a next interval J from the block which include I Next interval J has min-right such that l(J)>r 7. Push J into the heap H

Results TimeSpaceIdea Greedy O(n log n)O(n) wordsSorting Snoeyink [2004] O(n log k)O(n) words Divide and Conquer Bhattacharya et al. [2014] O(n’ (log s + n/s))O(s) wordsHeap Ours 1 O(n’ (log sk/n + n/s))O(s) wordsTournament Trees Ours 2 O(n’’ (log wsk/n + n/(ws))) O(s) words = O(ws) bits Navigation Piles Trigger Piles n: # input intervals, k: output size 1 word = w bits n’ = min{n, sk}, n’’ = min{n, wsk}

Workspace: O(s) words [Asano et al. 2013] Min-tournament tree Complete binary tree with s leaves #nodes: 2s-1 Partition the input into s blocks Each leaf corresponds to a block At most one interval from each block is in the tree Key: right endpoint Validity: Left endpoint is larger than r Each internal node has minimum element in its children … … …… … B1B1 B2B2 BsBs … … Tournament Trees

After Output One Interval Naïve update process Extract the root interval Find a next interval in the corresponding block Update nodes in the path from the leaf to the root Our update procedure Bottom up and recursive update Updating intervals from the leaf to the root If there is an invalid interval in the updating path, then we refresh it recursively. …… invalid BiBi The root interval might be invalid! Valid interval: No intersection with outputted intervals After refresh, the root interval is valid. Lemma 1

Our algorithm 1 1. Initialize the tournament tree T and r=-∞ 2. While T is not empty do 3. Output an interval I in the root of T and update r 4. Refresh at the root of T Let T’ be a binary tree with height h and s’ leaves. The number of nodes in T’ is O(s’ log 2 h /s’). Lemma 2 invalid (Intuitive proof) Maximizing the number of nodes h log s’ h - log s’ 2s’-1 s’ (h – log s’) = s’ log 2 h /s’ s’

Our algorithm 1 #iteration: k = output size Let s i be #updated leaves in i th loop Refresh cost: O(s i log s/s i + s i n/s) Updating cost: O(s i log s/s i ) from Lemma 2, h=log s, s’=s i Search cost: O(s i n/s) 1. Initialize the tournament tree T and r=-∞ 2. While T is not empty do 3. Output an interval I in the root of T and update r 4. Refresh at the root of T Let T’ be a binary tree with height h and s’ leaves. The number of nodes in T’ is O(s’ log 2 h /s’). Lemma 2 invalid Time complexity

Results TimeSpaceIdea Greedy O(n log n)O(n) wordsSorting Snoeyink [2004] O(n log k)O(n) words Divide and Conquer Bhattacharya et al. [2014] O(n’ (log s + n/s))O(s) wordsHeap Ours 1 O(n’ (log sk/n + n/s))O(s) wordsTournament Trees Ours 2 O(n’’ (log wsk/n + n/(ws))) O(s) words = O(ws) bits Navigation Piles Trigger Piles n: # input intervals, k: output size 1 word = w bits n’ = min{n, sk}, n’’ = min{n, wsk}

Conclusion and Future Works New operation and its analysis for priority queues Algorithms on intervals Maximum independent set Minimum dominating set Connected dominating set Paired dominating set etc. Future Works Independent dominating set on intervals Weighted problems Implementation of these algorithms Running time are same