Andrew’s Leap 2011 Pancakes With A Problem Steven Rudich.

Slides:



Advertisements
Similar presentations
Sorting by reversals Bogdan Pasaniuc Dept. of Computer Science & Engineering.
Advertisements

Midwestern State University Department of Computer Science Dr. Ranette Halverson CMPS 2433 – CHAPTER 4 GRAPHS 1.
Great Theoretical Ideas in Computer Science
Greedy Algorithms CS 6030 by Savitha Parur Venkitachalam.
CSC 2300 Data Structures & Algorithms March 16, 2007 Chapter 7. Sorting.
© The McGraw-Hill Companies, Inc., Chapter 2 The Complexity of Algorithms and the Lower Bounds of Problems.
Cooking for Computer Scientists. I understand that making pancakes can be a dangerous activity and that, by doing so, I am taking a risk that I.
Bioinformatics Chromosome rearrangements Chromosome and genome comparison versus gene comparison Permutations and breakpoint graphs Transforming Men into.
Greedy Algorithms And Genome Rearrangements
Genome Rearrangements CIS 667 April 13, Genome Rearrangements We have seen how differences in genes at the sequence level can be used to infer evolutionary.
1 Greedy Algorithms. 2 2 A short list of categories Algorithm types we will consider include: Simple recursive algorithms Backtracking algorithms Divide.
2 -1 Chapter 2 The Complexity of Algorithms and the Lower Bounds of Problems.
Introduction to Bioinformatics Algorithms Greedy Algorithms And Genome Rearrangements.
Discrete Structures & Algorithms EECE 320 : UBC : Spring 2009 Matei Ripeanu 1.
Of Mice and Men Learning from genome reversal findings Genome Rearrangements in Mammalian Evolution: Lessons From Human and Mouse Genomes and Transforming.
Genome Rearrangements CSCI : Computational Genomics Debra Goldberg
Transforming Cabbage into Turnip: Polynomial Algorithm for Sorting Signed Permutations by Reversals Journal of the ACM, vol. 46, No. 1, Jan 1999, pp
Pancakes With A Problem! Great Theoretical Ideas In Computer Science Steven Rudich CS Spring 2004 Lecture 1 Jan 13, 2004 Carnegie Mellon University.
1 Sorting by Transpositions Based on the First Increasing Substring Concept Advisor: Professor R.C.T. Lee Speaker: Ming-Chiang Chen.
Theoretical Computer Science COMP 335 Fall 2004
Phylogenetic Tree Construction and Related Problems Bioinformatics.
7-1 Chapter 7 Genome Rearrangement. 7-2 Background In the late 1980‘s Jeffrey Palmer and colleagues discovered a remarkable and novel pattern of evolutionary.
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.
Pancakes With A Problem! Great Theoretical Ideas In Computer Science Vince Conitzer COMPSCI 102 Fall 2007 Lecture 1 August 27, 2007 Duke University.
Cooking for Computer Scientists. I understand that making pancakes can be a dangerous activity and that, by doing so, I am taking a risk that I.
1 1 Slide © 2000 South-Western College Publishing/ITP Slides Prepared by JOHN LOUCKS.
Describing algorithms in pseudo code To describe algorithms we need a language which is: – less formal than programming languages (implementation details.
CompSci 102 Spring 2012 Prof. Rodger January 11, 2012.
Recursion, Complexity, and Searching and Sorting By Andrew Zeng.
Pancakes With A Problem! Great Theoretical Ideas In Computer Science Anupam Gupta CS Fall 2O05 Lecture 1 Aug 29 th, 2OO5 Aug 29 th, 2OO5 Carnegie.
Genome Rearrangements Tseng Chiu Ting Sept. 24, 2004.
Pancakes With A Problem! Great Theoretical Ideas In Computer Science Anupam Gupta CS Fall 2006 Lecture 1 Aug 29 th, 2OO6 Aug 29 th, 2OO6 Carnegie.
Great Theoretical Ideas in Computer Science.
1 A Simpler 1.5- Approximation Algorithm for Sorting by Transpositions Combinatorial Pattern Matching (CPM) 2003 Authors: T. Hartman & R. Shamir Speaker:
Recursion, Complexity, and Sorting By Andrew Zeng.
Genome Rearrangements Unoriented Blocks. Quick Review Looking at evolutionary change through reversals Find the shortest possible series of reversals.
Greedy Algorithms And Genome Rearrangements An Introduction to Bioinformatics Algorithms (Jones and Pevzner)
Genome Rearrangements [1] Ch Types of Rearrangements Reversal Translocation
Greedy Algorithms And Genome Rearrangements
Distributed Computing 3. Leader Election – lower bound for ring networks Shmuel Zaks ©
Algorithms and their Applications CS2004 ( ) Professor Jasna Kuljis (adapted from Dr Steve Swift) 6.1 Classic Algorithms - Sorting.
Graph Colouring L09: Oct 10. This Lecture Graph coloring is another important problem in graph theory. It also has many applications, including the famous.
Chapter 18: Searching and Sorting Algorithms. Objectives In this chapter, you will: Learn the various search algorithms Implement sequential and binary.
Analysis of Algorithms CS 477/677 Instructor: Monica Nicolescu Lecture 7.
Pancakes With A Problem! Great Theoretical Ideas In Computer Science Steven Rudich CS Spring 2005 Lecture 3 Jan 18, 2005 Carnegie Mellon University.
I can write and graph an equation of a direct variation.
Pancake Problem 許凱平 & 張傑生. Resources Google “ Bounds for Sorting by Prefix Reversal ” (63) “ Pancake Problem ” (218) Slides [S1] CMU ’ s “ Great Theoretical.
Chapter 9 Sorting. The efficiency of data handling can often be increased if the data are sorted according to some criteria of order. The first step is.
Introduction to Bioinformatics Algorithms Chapter 5 Greedy Algorithms and Genome Rearrangements By: Hasnaa Imad.
Genome Rearrangements. Turnip vs Cabbage: Look and Taste Different Although cabbages and turnips share a recent common ancestor, they look and taste different.
Outline Today’s topic: greedy algorithms
1 Genome Rearrangements (Lecture for CS498-CXZ Algorithms in Bioinformatics) Dec. 6, 2005 ChengXiang Zhai Department of Computer Science University of.
Chapter 9 sorting. Insertion Sort I The list is assumed to be broken into a sorted portion and an unsorted portion The list is assumed to be broken into.
1 Chapter 5 DIFFERENCE EQUATIONS. 2 WHAT IS A DIFFERENCE EQUATION? A Difference Equation is a relation between the values y k of a function defined on.
Lecture 2: Genome Rearrangements. Outline Cancer Sequencing Transforming Cabbage into Turnip Genome Rearrangements Sorting By Reversals Pancake Flipping.
The material in this lecture should be review. If you have not seen it before, you should be able to learn it quickly – and on your own. So we are going.
Pancakes With A Problem!
Exact Inference Continued
CSE 5290: Algorithms for Bioinformatics Fall 2009
Greedy (Approximation) Algorithms and Genome Rearrangements
Pancakes With A Problem!
CSCI2950-C Lecture 4 Genome Rearrangements
Pancake Sorting Input: Stack of pancakes, each of different sizes
Cooking for Computer Scientists.
Exact Inference Continued
Greedy Algorithms And Genome Rearrangements
Bounds for Sorting by Prefix Reversal -- Pancake Problem
Concepts of Computation
Presentation transcript:

Andrew’s Leap 2011

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. Therefore, when I deliver them to a customer, on the way to the table I rearrange them (so that the smallest winds up on top, and so on, down to the largest at the bottom) by grabbing several from the top and flipping them over, repeating this (varying the number I flip) as many times as necessary.

Developing A Notation: Turning pancakes into numbers

So how many flips to sort this particular stack?

4 Flips Are Sufficient

Algebraic Representation X = The smallest number of flips required to sort: ?  X  ? Upper Bound Lower Bound

Algebraic Representation X = The smallest number of flips required to sort: ?  X  4 Upper Bound Lower Bound

Algebraic Representation X = The smallest number of flips required to sort: 1  X  4 Upper Bound Lower Bound

Algebraic Representation X = The smallest number of flips required to sort: 2  X  4 Upper Bound Lower Bound

Algebraic Representation X = The smallest number of flips required to sort: 3  X  4 Upper Bound Lower Bound

4 Flips Are Necessary Flip 1 has to put 5 on bottom. Flip 2 must bring 4 to top.

Algebraic Representation X = The smallest number of flips required to sort: 4  X  4 Upper Bound Lower Bound

Upper Bound Lower Bound 4  X  4 X = 4

5 th Pancake Number P 5 = The number of flips required to sort the worst case stack of 5 pancakes. ?  P 5  ? Upper Bound Lower Bound

5 th Pancake Number P 5 = The number of flips required to sort the worst case stack of 5 pancakes. 4  P 5  ? Upper Bound Lower Bound

The 5 th Pancake Number: The MAX of the X’s X1X1 X2X2 X3X3 X 119 X

n th Pancake Number P n = The number of flips required to sort the worst case stack of n pancakes. ?  P n  ? Upper Bound Lower Bound

?  P n  ? What bounds can you prove on P n ?

Bring To Top Method Bring biggest to top. Place it on bottom. Bring next largest to top. Place second from bottom. And so on…

Upper Bound On P n : Bring To Top Method For n Pancakes If n=1, no work - we are done. Otherwise, flip pancake n to top and then flip it to position n. Now use: Bring To Top Method For n-1 Pancakes Total Cost: at most 2(n-1) = 2n –2 flips.

Better Upper Bound On P n : Bring To Top Method For n Pancakes If n=2, at most one flip, we are done. Otherwise, flip pancake n to top and then flip it to position n. Now use: Bring To Top Method For n-1 Pancakes Total Cost: at most 2(n-2) + 1 = 2n –3 flips.

Bring to top not always optimal for a particular stack 5 flips, but can be done in 4 flips

?  P n  2n - 3 What bounds can you prove on P n ?

9 16 Breaking Apart Argument Suppose a stack S contains a pair of adjacent pancakes that will not be adjacent in the sorted stack. Any sequence of flips that sorts stack S must involve one flip that inserts the spatula between that pair and breaks them apart.

9 16 Breaking Apart Argument Suppose a stack S contains a pair of adjacent pancakes that will not be adjacent in the sorted stack. Any sequence of flips that sorts stack S must involve one flip that inserts the spatula between that pair and breaks them apart. Furthermore, this same principle is true of the “pair” formed by the bottom pancake of S and the plate.

n  P n Suppose n is even. S contains n pairs that will need to be broken apart during any sequence that sorts stack S n n-1 S

n  P n Suppose n is odd. S contains n pairs that will need to be broken apart during any sequence that sorts stack S n n-1 S Detail: This construction only works when n>3

n  P n  2n - 3 Bring To Top is within a factor of two of optimal

n  P n  2n - 3 So starting from ANY stack we can get to the sorted stack using no more than P n flips.

From ANY stack to Sorted Stack in · P n Can you see why we can get from the Sorted stack to ANY stack in · P n flips? Reverse the sequences we use to sort.

From Sorted Stack to ANY stack in · P n Can you see why we can get from ANY stack S to ANY stack T in · P n flips?

From ANY Stack S to ANY stack T in P n ST

From ANY Stack S to ANY stack T in P n RENAME PANCAKES IN YELLOW SO THAT S IS SORTED. THIS FIXES THE YELLOW ORDERING OF THE STACK T ST

The Known Pancake Numbers n PnPn

P 18 Is Unknown 18! Orderings of 18 pancakes. 18! = 6,402,373,705,728,000

Burnt Pancake Numbers n PnPn

Is This Really Computer Science?

Posed in Amer. Math. Monthly 82 (1) (1975), “Harry Dweighter” a.k.a. Jacob Goodman

(17/16)n  P n  (5n+5)/3 Bill Gates & Christos Papadimitriou: Bounds For Sorting By Prefix Reversal. Discrete Mathematics, vol 27, pp 47-57, 1979.

(15/14)n  P n  (5n+5)/3 H. Heydari & H. I. Sudborough: On the Diameter of he Pancake Network. Journal of Algorithms, vol 25, pp 67-94, 1997.

P n  18n/11 An (18/11)n Upper Bound for Sorting by Prefix Reversals B. Chitturi, W. Fahle, Z. Meng, L. Morales, C. O. Shields, I. H. Sudborough, and W. Voit. Theoretical Computer Science, to appear

Pancake Network: Definition For n! Nodes For each node, assign it the name of one of the n! stacks of n pancakes. Put a wire between two nodes if they are one flip apart.

Network For n=

Network For n=4

Pancake Network: Message Routing Delay What is the maximum distance between two nodes in the network? PnPn

Pancake Network: Reliability If up to n-2 nodes get hit by lightning the network remains connected, even though each node is connected to only n-1 other nodes. The Pancake Network is optimally reliable for its number of edges and nodes.

Mutation Distance One Can flip any consecutive subsequence TGCGTCCA TGCCCTGA

Mutation Distance Three!!! Transforming cabbage into turnip: polynomial algorithm for sorting signed permutations by reversals. Sridhar Hannenhalli Pavel A. Pevzner Journal of the ACM 1999

One “Simple” Problem A host of problems and applications at the frontiers of science