Pancake Sorting Input: Stack of pancakes, each of different sizes

Slides:



Advertisements
Similar presentations
Simulation Examples in EXCEL Montana Going Green 2010.
Advertisements

Registers and Counters. Register Register is built with gates, but has memory. The only type of flip-flop required in this class – the D flip-flop – Has.
Merge and Count Merge and count step. n Given two sorted halves, count number of inversions where a i and a j are in different.
Selection Sort
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.
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.
Fractions that Equal Whole Numbers
Match the Fractions © 2014 Teacher to Teacher Publications, Inc Carlos Suzy.
CIS3023: Programming Fundamentals for CIS Majors II Summer 2010 Ganesh Viswanathan Sorting Course Lecture Slides 24 May 2010 “The real focus here is bringing.
Algorithmic Foundations COMP108 COMP108 Algorithmic Foundations Divide and Conquer Prudence Wong.
Operations with Rational Numbers Any number that can be written in the form, where m and n are integers and n 0, is called a rational number In other.
Genome Rearrangements [1] Ch Types of Rearrangements Reversal Translocation
Created by: Leslie Fenton. The Division Principle 8 ÷ 4 = 2 Dividend Divisor Quotient Dividend : The amount you want to divide up : The number you divide.
AUP2G57 configured as flip flop Dual Configurable Logic Design Contest.
SEQUENTIAL LOGIC By Tom Fitch. Types of Circuits Combinational: Gates Combinational: Gates Sequential: Flip-Flops Sequential: Flip-Flops.
Wild Card Fractions © Teacher to Teacher Publications, Inc RudyLan.
Math – What is a Function? 1. 2 input output function.
Refraction Statics Bryce Hutchinson Sumit Verma. 3D Statics display 1. Click this button on the right side of the statics window to open a 3D statics.
Multiplying and dividing fractions review. ⅔ ¹⁵/₁₆ If your fractions are proper, then you can cross cancel That means you are reducing early.
Selection Sort Comparison Data Movement Sorted.
Selection Sort
Ordering Decimals and Whole Numbers
CS1020E Lab 4 (Stack and Queue)
Sorting Sorting takes an unordered array and makes it an ordered one
Numbers Rounding & Decimals Pick 5 from the list.
A planar region R is called convex if and only if for any pair of points p, q in R, the line segment pq lies completely in R. Otherwise, it is called concave.
Multiplying Fractions. Fraction Multiplication Here are some fraction multiplication problems Can you tell how to multiply fraction from these examples?
Algorithmic Foundations COMP108 COMP108 Algorithmic Foundations Divide and Conquer Prudence Wong
Work and Machines How machines make our lives easier.
Sorting arrays/tables Top Down sort Please use speaker notes for additional information!
Math – Introduction to Functions 1. Let’s look at a graph of fuel prices (in $ per liter) over time… 2.
A LEVEL STUDENTS 2015: WELL DONE YEAR 13! RESULTS AVAILABLE FROM THE DINING ROOM FROM 10.00A.M.
Compare/Order positive and negative decimals Order from least to greatest Step 1 – separate out the negative numbers and.
Rational Numbers Essential Question: What do we need to do before we can add or subtract fractions? Unit 2 Day 4.
Rational Numbers Essential Question: What do we need to do before we can add or subtract fractions? Unit 2 day 8.
Click me for movie Get a 100% before moving on to next slide Screenshot here.
Least Common Multiple.
Multiples and Lowest Common Multiple
Multiplying and dividing decimals
COMP108 Algorithmic Foundations Divide and Conquer
COMP108 Algorithmic Foundations Divide and Conquer
Merging Merge. Keep track of smallest element in each sorted half.
Quad D Flip Flop Index Circuit Error Judgment Scenario
Writing JavaScript Code
Place Value: Comparing, Ordering, & Rounding
BINGO BINGO Rounding &
شاخصهای عملکردی بیمارستان
Monday 3/19/18 WEEK 11 Agenda Warm Up
BOTTOM UP PARSING Lecture 16.
مدل زنجیره ای در برنامه های سلامت
Infix to Postfix Conversion
فرق بین خوب وعالی فقط اندکی تلاش بیشتر است
Assignment 1.
Function Notation Transformations.
Function Notation “f of x” Input = x Output = f(x) = y.
Change to Mixed Number---7/4
Linked List and Selection Sort
Create an input-output table from the following rule or scenario
Exponential and Logarithmic Forms
A G L O R H I M S T A Merging Merge.
Using Doubles Fish Problems
Intro to Computer Science CS1510 Dr. Sarah Diesburg
A G L O R H I M S T A Merging Merge.
Perimeter [ GM3.1 Support Plenary]
Do Now M + 5 = 3 S – 4 = = a + 6 9y = = 0.3p.
A G L O R H I M S T A Merging Merge.
Line Symmetry.
Sorting and Complexity

Arithmatic Logic Unit (ALU). ALU Input Data :  A0-A3  B0-B3 Output Data :  F0 – F3.
Presentation transcript:

Pancake Sorting Input: Stack of pancakes, each of different sizes Output: Arrange in order of size (smallest on top) Action: Slip a flipper under one of the pancakes and flip over the whole stack above the flipper 3 2 finish 4 1 1 start 2 3 4

A Flip Action: Slip a flipper under one of the pancakes and flip over the whole stack above the flipper 3 2 4 flip here 1 4 2 3 1

How? 1 2 3 4 2 2 4 3 1 1 4 3 3 1 1 3 2 2 4 4 5 6 Done! 2 1 1 2 3 3 4 4

For n pancakes, at most 2(n-1) flips More Pancakes? 2 4 5 1 6 3 For n pancakes, at most 2(n-1) flips