TECH Computer Science Problem: Selection Design and Analysis: Adversary Arguments The selection problem >  Finding max and min Designing against an adversary.

Slides:



Advertisements
Similar presentations
Comp 122, Spring 2004 Order Statistics. order - 2 Lin / Devi Comp 122 Order Statistic i th order statistic: i th smallest element of a set of n elements.
Advertisements

110/6/2014CSE Suprakash Datta datta[at]cse.yorku.ca CSE 3101: Introduction to the Design and Analysis of Algorithms.
MS 101: Algorithms Instructor Neelima Gupta
Lecture 19. Reduction: More Undecidable problems
Lower Bounds for Sorting, Searching and Selection
MS 101: Algorithms Instructor Neelima Gupta
Analysis of Algorithms
Lower bound: Decision tree and adversary argument
Theory of Computing Lecture 3 MAS 714 Hartmut Klauck.
Mathematical Induction II Lecture 14: Nov
Lecture 12: Lower bounds By "lower bounds" here we mean a lower bound on the complexity of a problem, not an algorithm. Basically we need to prove that.
Medians and Order Statistics
Introduction to Algorithms
Deterministic Selection and Sorting Prepared by John Reif, Ph.D. Analysis of Algorithms.
SEARCHING, SORTING, TOPOLOGICAL SORTS Most real world computer applications deal with vast amounts of data. Searching for a particular data item can take.
Insertion Sort Algorithm : Design & Analysis [5].
Lecture 13: Adversary Arguments continues … This lecture, we continue with the adversary argument by giving more examples.
Finding the Median Algorithm : Design & Analysis [11]
Lecture 5: Linear Time Sorting Shang-Hua Teng. Sorting Input: Array A[1...n], of elements in arbitrary order; array size n Output: Array A[1...n] of the.
Ch. 7 - QuickSort Quick but not Guaranteed. Ch.7 - QuickSort Another Divide-and-Conquer sorting algorithm… As it turns out, MERGESORT and HEAPSORT, although.
CSC 2300 Data Structures & Algorithms March 27, 2007 Chapter 7. Sorting.
Analysis of Algorithms CS 477/677 Instructor: Monica Nicolescu.
Adversarial Search: Game Playing Reading: Chess paper.
©The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 4 th Ed Chapter Chapter 11 Sorting and Searching.
Chapter 11 Limitations of Algorithm Power Copyright © 2007 Pearson Addison-Wesley. All rights reserved.
Problem: Selection Design and Analysis: Adversary Arguments The selection problem >  Finding max and min Adversary Arguments( 反论 )  Suppose you are playing.
Hardness Results for Problems P: Class of “easy to solve” problems Absolute hardness results Relative hardness results –Reduction technique.
10/15/2002CSE More on Sorting CSE Algorithms Sorting-related topics 1.Lower bound on comparison sorting 2.Beating the lower bound 3.Finding.
CS 202, Spring 2003 Fundamental Structures of Computer Science II Bilkent University1 Sorting CS 202 – Fundamental Structures of Computer Science II Bilkent.
Chapter 11 Limitations of Algorithm Power. Lower Bounds Lower bound: an estimate on a minimum amount of work needed to solve a given problem Examples:
Week 11 Introduction to Computer Science and Object-Oriented Programming COMP 111 George Basham.
Order Statistics The ith order statistic in a set of n elements is the ith smallest element The minimum is thus the 1st order statistic The maximum is.
Jessie Zhao Course page: 1.
SEARCHING. Vocabulary List A collection of heterogeneous data (values can be different types) Dynamic in size Array A collection of homogenous data (values.
COMP Recursion, Searching, and Selection Yi Hong June 12, 2015.
The Selection Problem. 2 Median and Order Statistics In this section, we will study algorithms for finding the i th smallest element in a set of n elements.
Lars Arge1 Permuting Lower Bound Permuting N elements according to a given permutation takes I/Os in “indivisibility” model Indivisibility model: Move.
1 Lower Bounds Lower bound: an estimate on a minimum amount of work needed to solve a given problem Examples: b number of comparisons needed to find the.
Games. Adversaries Consider the process of reasoning when an adversary is trying to defeat our efforts In game playing situations one searches down the.
Intro to Sorting Intro to Computer Science CS1510 Dr. Sarah Diesburg.
Instructor Neelima Gupta Table of Contents Review of Lower Bounding Techniques Decision Trees Linear Sorting Selection Problems.
Selection Sort Comparison Data Movement Sorted.
Lists in Python Selection Sort Algorithm. Sorting A very common activity for computers Not just in business, sorting is used in databases, graphics, simulations,
Analysis of Algorithms CS 477/677 Instructor: Monica Nicolescu Lecture 7.
Space-Efficient Online Computation of Quantile Summaries SIGMOD 01 Michael Greenwald & Sanjeev Khanna Presented by ellery.
COSC 3101A - Design and Analysis of Algorithms 6 Lower Bounds for Sorting Counting / Radix / Bucket Sort Many of these slides are taken from Monica Nicolescu,
1 Ch. 2: Getting Started. 2 About this lecture Study a few simple algorithms for sorting – Insertion Sort – Selection Sort (Exercise) – Merge Sort Show.
Young CS 331 D&A of Algo. Topic: Divide and Conquer1 Divide-and-Conquer General idea: Divide a problem into subprograms of the same kind; solve subprograms.
CSC317 1 Quicksort on average run time We’ll prove that average run time with random pivots for any input array is O(n log n) Randomness is in choosing.
Review 1 Merge Sort Merge Sort Algorithm Time Complexity Best case Average case Worst case Examples.
Today’s Material Sorting: Definitions Basic Sorting Algorithms
Sorting and Shuffling Arrays CS 233G Intermediate C++ Programming for Games.
The Selection Algorithm : Design & Analysis [10].
Sorting Lower Bounds n Beating Them. Recap Divide and Conquer –Know how to break a problem into smaller problems, such that –Given a solution to the smaller.
Insertion Sort Algorithm : Design & Analysis [4].
Sorting & Lower Bounds Jeff Edmonds York University COSC 3101 Lecture 5.
Mathematical Induction II
Randomized Algorithms
Searching CSCE 121 J. Michael Moore.
Intro to Computer Science CS1510 Dr. Sarah Diesburg
Lower Bound Theory.
Analysis and design of algorithm
Rank Aggregation.
Randomized Algorithms
Chapter 11 Limitations of Algorithm Power
Intro to Computer Science CS1510 Dr. Sarah Diesburg
Chapter 9: Medians and Order Statistics
Topic: Divide and Conquer
The Selection Problem.
Algorithms CSCI 235, Spring 2019 Lecture 19 Order Statistics
Presentation transcript:

TECH Computer Science Problem: Selection Design and Analysis: Adversary Arguments The selection problem >  Finding max and min Designing against an adversary >

Design and Analysis using Adversary arguments An algorithm is playing an Information game against an adversary.  The algorithm wants to get as much Information as possible in order to get as much work done as effective as possible.  The adversary wants to give as least Information as possible to give the algorithm the worst case.  The rule of the game is Consistency. The adversary can trick but cannot cause inconsistency in the given information. e.g. your algorithm needs to guess a date (a month and day) and your adversary gives yes/no answers.  Let’s play!

Strategy for Designing against an adversary Assume a strong adversary!  the adversary will give as least information as possible Choose questions (or operations) as balance as possible  e.g. for comparison of two keys, x > y  Yes: x > y and  No: x not > y  should provide about the same amount information

The Selection Problem Find an element with rank k  in an array E using indexes 1 through n  the elements in E are assumed to be unsorted  where 1 <= k <= n Finding an element with rank k is equivalent to answering the question:  If the array were sorted in nondecreasing order  which element would be in E[k]? The largest key (called max) should be k = n The smallest key (called min) should be k = 1 The median key should be k = Ceiling[n/2]

Finding min, finding max, finding min and max Finding min in an unsorted array of n elements  require at least n-1 comparisons Finding max in an unsorted array of n elements  require at least n-1 comparisons Now we want to find both min and max  can we do better than 2(n-1) ?  What is the lower bound? Theorem: Any algorithm to find both min and max of n keys by comparison of keys must do at least 3n/2 – 2 key comparisons in the worst case.

Proof by adversary arguments and units of information To know that a key v is max, an algorithm must know that every key other than v has lost some comparison  To know that a key u is min, an algorithm must know that every key other than u has won some comparison. If we count each win as one unit of information and each loss as one unit of information  Then an algorithm must have at least 2(n-1) units of information for finding both min and max We need to determine how many comparison are required (in the worst case) to get total 2(n-1) units of information.  The adversary to give us the worst case will provide as few information as possible.

The adversary strategy to give us the worst case

Our strategy to gain as must information Our algorithm can do at most n/2 comparisons of previously unseen keys  suppose for the moment that n is even  each of these comparison give us 2 units of information  now we have n units of information Our algorithm need total 2(n-1) = 2n – 2, so now we need n – 2 additional units of information  for each other comparison we gain at most one unit of information  so we need at least n – 2 additional comparisons In total our algorithm requires at least n/2 + n – 2 comparisons. For n is odd, 3n/2 – 3/2 comparisons are needed. QED

Design an algorithm to find min and max Now we know the lower bound (in the worst case)  Can we design an algorithm to reach the lower bound? Exercise  design an algorithm to find both min and max  the algorithm should do at most (about) 3n/2 comparison (in the worst case) for a problem size of n elements