Integer Representations and Counting in the Bit Probe Model M. Zaiur Rahman and J. Ian Munro Cheriton School of Computer Science University of Waterloo.

Slides:



Advertisements
Similar presentations
Walks, Paths and Circuits Walks, Paths and Circuits Sanjay Jain, Lecturer, School of Computing.
Advertisements

Routing in a Parallel Computer. A network of processors is represented by graph G=(V,E), where |V| = N. Each processor has unique ID between 1 and N.
5th July 2004CPM A Simple Optimal Representation for Balanced Parentheses Richard Geary, Naila Rahman, Rajeev Raman (University of Leicester, UK)
The Binary Numbering Systems
On the Competitiveness of Self Organizing Linear Search J. Ian Munro (University of Waterloo) Competitiveness: How well does an on line algorithm do in.
CSC 2300 Data Structures & Algorithms March 16, 2007 Chapter 7. Sorting.
Zoo-Keeper’s Problem An O(nlogn) algorithm for the zoo-keeper’s problem Sergei Bespamyatnikh Computational Geometry 24 (2003), pp th CGC Workshop.
Binary Counters Integer Representations towards Efficient Counting in the Bit Probe Model (paper presented at TAMC 2011) Gerth Stølting Brodal (Aarhus.
CSE115: Introduction to Computer Science I Dr. Carl Alphonce 219 Bell Hall 1.
Binary Counters Integer Representations towards Efficient Counting in the Bit Probe Model (presented at TAMC 2011) Gerth Stølting Brodal (Aarhus University)
CSE115: Introduction to Computer Science I Dr. Carl Alphonce 219 Bell Hall 1.
Performance Analysis and Optimization. Performance: Time Space Power (cost) (weight) {development time, ease of maintenance, extensibility} Note: 1. “big-O”
Parallel Routing Bruce, Chiu-Wing Sham. Overview Background Routing in parallel computers Routing in hypercube network –Bit-fixing routing algorithm –Randomized.
Lecture 6: Point Location Computational Geometry Prof. Dr. Th. Ottmann 1 Point Location 1.Trapezoidal decomposition. 2.A search structure. 3.Randomized,
1 Section 2.5 Integers and Algorithms. 2 Euclidean algorithm for finding gcd Where L is a larger number, and S is a smaller number, to find gcd(L,S):
An Approach to Generalized Hashing Michael Klipper With Dan Blandford Guy Blelloch.
CS 202, Spring 2003 Fundamental Structures of Computer Science II Bilkent University1 Sorting CS 202 – Fundamental Structures of Computer Science II Bilkent.
Number System and Codes
Pancakes With A Problem Steven Rudich The chef at our place is sloppy, and when he prepares a stack of pancakes they come out all different sizes.
Data Representation – Chapter 3 Sections 3-2, 3-3, 3-4.
COMP201 Computer Systems Number Representation. Number Representation Introduction Number Systems Integer Representations Examples  Englander Chapter.
1.6 Signed Binary Numbers.
Binary Addition Addition Rules: = = = = = carry 1 1 carry 1 Example 1: Example 2:
Mike 66 Sept Succinct Data Structures: Techniques and Lower Bounds Ian Munro University of Waterloo Joint work with/ work of Arash Farzan, Alex Golynski,
Positional Number Systems
Lecture 2 We have given O(n 3 ), O(n 2 ), O(nlogn) algorithms for the max sub-range problem. This time, a linear time algorithm! The idea is as follows:
Numbering Systems CS208.
Counting in Binary Amortized and Worst-Case Efficiency © Robert E. Tarjan, 2013.
Mathematics Review and Asymptotic Notation
COM342 Networks and Data Communications
Space Efficient Data Structures for Dynamic Orthogonal Range Counting Meng He and J. Ian Munro University of Waterloo.
Data Representation.
1 Problem Solving using computers Data.. Representation & storage Representation of Numeric data The Binary System.
On realizing shapes in the theory of RNA neutral networks Speaker: Leszek Gąsieniec, U of Liverpool, UK Joint work with: Peter Clote, Boston College, USA.
Jessie Zhao Course page: 1.
Representation of Data Ma King Man. Reference Text Book: Volume 2 Notes: Chapter 19.
Number systems & Binary codes MODULE 1 Digital Logic Design Ch1-2 Outline of Chapter 1  1.1 Digital Systems  1.2 Binary Numbers  1.3 Number-base Conversions.
6 October 2015Birkbeck College, U. London1 Introduction to Computer Systems Lecturer: Steve Maybank Department of Computer Science and Information Systems.
Chapter 2: The Logic of Compound Statements 2.5 Application: Number Systems and Circuits for Addition 1 Counting in binary is just like counting in decimal.
TECH Computer Science Dynamic Sets and Searching Analysis Technique  Amortized Analysis // average cost of each operation in the worst case Dynamic Sets.
Succinct Data Structures Ian Munro University of Waterloo Joint work with David Benoit, Andrej Brodnik, D, Clark, F. Fich, M. He, J. Horton, A. López-Ortiz,
EEL 3801C EEL 3801 Part I Computing Basics. EEL 3801C Data Representation Digital computers are binary in nature. They operate only on 0’s and 1’s. Everything.
THE BINARY SYSTEM.
Tutorial: ITI1100 Dewan Tanvir Ahmed SITE, UofO
Implicit Dictionaries with O(1) Modifications per Update and Fast Search Gianni Franceschini and Ian Munro  Elements kept in 1 st n positions of an array.
Signed Binary Numbers Arithmetic Subtraction – In 2’s-complement form: Example: 1.Take the 2’s complement of the subtrahend (including the sign bit) and.
1/6/20161 CS 3343: Analysis of Algorithms Lecture 2: Asymptotic Notations.
1 Fat heaps (K & Tarjan 96). 2 Goal Want to achieve the performance of Fibonnaci heaps but on the worst case. Why ? Theoretical curiosity and some applications.
CMSC 341 Binomial Queues and Fibonacci Heaps. Basic Heap Operations OpBinary Heap Leftist Heap Binomial Queue Fibonacci Heap insertO(lgN) deleteMinO(lgN)
CS321 Data Structures Jan Lecture 2 Introduction.
Georgia Institute of Technology Introduction to Programming Part 3 Barb Ericson Georgia Institute of Technology May 2006.
©2010 Cengage Learning SLIDES FOR CHAPTER 1 INTRODUCTION NUMBER SYSTEMS AND CONVERSION Click the mouse to move to the next page. Use the ESC key to exit.
1 Space-Efficient TCAM-based Classification Using Gray Coding Authors: Anat Bremler-Barr and Danny Hendler Publisher: IEEE INFOCOM 2007 Present: Chen-Yu.
Nguyen Le CS147.  2.4 Signed Integer Representation  – Signed Magnitude  – Complement Systems  – Unsigned Versus Signed Numbers.
Lecture 5 Algorithm Analysis Arne Kutzner Hanyang University / Seoul Korea.
Computer Representation of Information
Topic: Binary Encoding – Part 2
Integers’ Representation. Binary Addition. Two's Complement.
CS 3343: Analysis of Algorithms
Rabin & Karp Algorithm.
Lecture 5 Algorithm Analysis
Lecture 5 Algorithm Analysis
Count Sort, Bucket Sort, Radix Sort
EEL 3705 / 3705L Digital Logic Design
Unit 18: Computational Thinking
Number Representation
CPS120: Introduction to Computer Science
OBJECTIVES After reading this chapter, the reader should be able to :
Lecture 5 Algorithm Analysis
Today Binary addition Representing negative numbers 2.
Presentation transcript:

Integer Representations and Counting in the Bit Probe Model M. Zaiur Rahman and J. Ian Munro Cheriton School of Computer Science University of Waterloo Waterloo On Canada

Integer Representations Standard: n bits representing {0..2 n } # bits … optimal Increment: –Θ(n) bit inspections/changes worst case –O(1) amortized, but not if we include decrement

Redundant Binary Numbers Use “digits” 0,1,2 but representation is in binary, 2 is a delayed carry e.g = Space 2n bits (or reduce to about (lg 3) n) –Increment O(1), as we de-amortize the scan to release the rightmost carry –Decrement is tricky, easiest to use digit “-1” –Note the extra lg n bits for the scan pointer

Gray Codes.. Due to Gray..of course Binary Reflected Gray Code (BRGC) –Of dimension n (i.e. n bits, numbers [0..2 n ] –A sequence of 2 n strings each of length n G(n) = 0.G(n-1), 1.G(n-1) R (reversal is on the sequence order, not the individual codes)

Increment on a Gray Code Even parity: flip rightmost 1 bit

Increment on a Gray Code Even parity: flip rightmost bit →

Increment on a Gray Code Even parity: flip rightmost bit → Odd parity: flip the bit to left of rightmost →

Increment on a Gray Code Even parity: flip rightmost bit → Odd parity: flip the bit to left of rightmost → Costs:1 bit changed, n inspections (worst case) Or: add parity bit, O(1) amortized insert, 2 bits changed Integrate parity bit with code (no extra bit [Lucal])

Our First Result: Lower Bound Theorem: Any representation of [0..2 n ] using exactly n bits requires Ω(√n) bit inspections in the worst case. Proof: Model, apply Sunflower Lemma and manipulate

Sunflower Lemma [Ёrdos & Rado] Sunflower with p petals –Sets S 1, …, S p so S i  S j is same for all i,j Lemma: S 1, …, S p is a system of sets each of size at most q. If m>(p-1) q+1 q!, then it contains a subcollection with p petals Use the lemma with m as small as possible

Back to Algorithms We want a scheme that balances (as well as possible) –Bit changes –Bit inspections –Extra bits Lower bound says no extra bits  lots of inspections

The increment in BRGC Key issue … that rightmost 1 Lemma: On increment or decrement, the position of rightmost 1 in any segment of the leftmost bits changes only when that bit is flipped, except for the case of leftmost bit going 1→0 on increment (or 0 → 1 on decrement)

De-amortizing The lemma lets us de-amortize: as with redundant binary representation. With some details: Theorem: There is a representation using n + lg n + 3 bits (a pointer is in there), requiring 2 lg n +4 bit inspections and 4 bit changes for increment or decrement.

Moving Along Complicating issue: Mixing increments and decrements forces us to add flags –(for {inc, dec} and {done yet, not done} Idea: use the lower order lg n bits to give the pointer into the leftmost n - lg n bits –This would seem to require a table (or model issue) to translate

But Permute the code of the leading n – lg n bits and use trailing bits directly to walk through them in “code order” Indeed, we don’t need n – lg n to be a power of 2 Theorem: There is a representation using n + 3 bits, requiring lg n + 6 bit inspections and 7 bit changes for increment or decrement.

Addition and Subtraction Adding or subtracting and m digit (standard notation) integer to update an n digit integer (n > m): –n + O(lg 2 n) bits, –O(m + lg n) inspections/changes

Open Issues Improve the lower bound to n bits inspected in no extra bits Lower bound trading off bits changed with space and bits inspected Tweaking upper bounds