HKOI 2008 FINAL EVENT Q3 STORAGE BOX

Slides:



Advertisements
Similar presentations
DT Coursework By D. Henwood.
Advertisements

How SAS implements structured programming constructs
Senior Q2 Shy Tortoise. Sample >>> > > >>
Advanced Topics in Algorithms and Data Structures Lecture 7.2, page 1 Merging two upper hulls Suppose, UH ( S 2 ) has s points given in an array according.
電腦視覺 Computer and Robot Vision I Chapter2: Binary Machine Vision: Thresholding and Segmentation Instructor: Shih-Shinh Huang 1.
Recursion and Exhaustion Hong Kong Olympiad in Informatics 2009 Hackson Leung
Advanced Algorithms Computational Geometry Spring 2004 Cristina Neacsu.
QBM117 Business Statistics
Chapter 19 Linear Programming McGraw-Hill/Irwin
Linear Programming McGraw-Hill/Irwin Copyright © 2012 by The McGraw-Hill Companies, Inc. All rights reserved.
Who moved my cheese? Solution for HKOI2008 Junior Q4.
One to One Functions A function is one to one if each y value is associated with only one x value. A one to one function passes both the vertical and horizontal.
1 Prune-and-Search Method 2012/10/30. A simple example: Binary search sorted sequence : (search 9) step 1  step 2  step 3  Binary search.
Solve by using the ELIMINATION method The goal is to eliminate one of the variables by performing multiplication on the equations. Multiplication is not.
Solve by using the ELIMINATION method The goal is to eliminate one of the variables by performing multiplication on the equations, and then add the two.
ES 07 These slides can be found at optimized for Windows)
Solving Equations with Variables on Both Sides. Review O Suppose you want to solve -4m m = -3 What would you do as your first step? Explain.
Lecture Slides Elementary Statistics Twelfth Edition
Chapter 13 Recursion Copyright © 2016 Pearson, Inc. All rights reserved.
OPERATING SYSTEMS CS 3502 Fall 2017
Chapter 4 (Part 3): Mathematical Reasoning, Induction & Recursion
Clustering Motion or Crunching Clusters, Hiding Logs
deterministic operations research
CSC 421: Algorithm Design & Analysis
CSC 421: Algorithm Design & Analysis
Chapter 3 Describing Data Using Numerical Measures
Introduction To Logarithms
What to do when a test fails
GC211Data Structure Lecture2 Sara Alhajjam.
Core Focus on Linear Equations
Descriptive Statistics (Part 2)
CSC 421: Algorithm Design & Analysis
How to use past papers effectively.
Solving Linear Systems of Equations - Concept
Chapter 6 ENGR 201: Statistics for Engineers
Introduction To Logarithms
Chapter 3 Describing Data Using Numerical Measures
Introduction To Logarithms
Unit# 9: Computer Program Development
CPU Scheduling G.Anuradha
Final Exam Review Department of Electrical and Computer Engineering
Programming Funamental slides
Ying shen Sse, tongji university Sep. 2016
GENERAL VIEW OF KRATOS MULTIPHYSICS
CSE 373: Data Structures and Algorithms
8/04/2009 Many thanks to David Sun for some of the included slides!
Multi-Step Equations & Special Solutions
Coding Concepts (Standards and Testing)
Implement FSM with fewest possible states • Least number of flip flops
Advanced Algorithms Analysis and Design
Learning Intention I will learn about evaluating a program.
Design Facts.
CSC 421: Algorithm Design & Analysis
Application of Differentiation
Multi-Step Equations & Special Solutions
Class 4: Repetition Pretest Posttest Counting Flowchart these!
Output Variables {true} S {i = j} i := j; or j := i;
Methodical Counting 01-LCR-02.
Math 1.
The Selection Problem.
FLIPPED CLASSROOM ACTIVITY CONSTRUCTOR – USING EXISTING CONTENT
MATHEMATICS From 3 Factorization of.
Chapter 13 Recursion Copyright © 2010 Pearson Addison-Wesley. All rights reserved.
CSC 421: Algorithm Design & Analysis
Tukey Box Plots Review.
Instructor: Aaron Roth
Heaps & Multi-way Search Trees
JEE Advanced 2019 Last Minute Tips & Tricks Every Aspirant Must Know Important Topics.
Given a list of n  8 integers, what is the runtime bound on the optimal algorithm that sorts the first eight? O(1) O(log n) O(n) O(n log n) O(n2)
Presentation transcript:

HKOI 2008 FINAL EVENT Q3 STORAGE BOX Hackson Leung 2007-12-29

AGENDA Statistics Problem Descriptions Pre-requisite Wrong Solutions “Correct” Solutions Correct Solution(s) Discussion

STATISTICS Min = 0 Max = 100 #Max = 3 Mode = 0

PROBLEM DESCRIPTIONS Given N books (by means of their co-ordinates) Find the optimal way to remove books such that the Kth book is not covered by any book The sequence of removal is important Target

PRE-REQUISITE Data Processing Simple geometry concept Basic Recursion technique

WRONG SOLUTIONS Wrong → 0 marks They contribute to correct solutions

WRONG SOLUTIONS Hardcode Remove-all Naïve removal

NAÏVE REMOVAL Project two vertical lines from two sides of the book Whenever the lines intersect (not touch) any book that is higher than the target, it should be removed Intersect Target

NAÏVE REMOVAL Can pass sample I/O Can correctly determine no-removal-case Problem(s) Easy to construct the sequence? Always correct? Target

OBSERVATIONS The books covering the Kth book are also removed Suppose one of them is the Pth book If the Pth book is optimally removed, then the Kth book is also removed optimally The problem becomes: how to remove the Pth book in the optimal way? The Pth book The Kth book

CORRECT SOLUTION From previous slide, it seems that we are doing the same job again and again Unless the top objects are not removed, the one below should remain stationary First-In-Last-Out (FILO) property holds Why not use recursion to solve? Θ(N2), fast enough for N < 1,000 Way to improve?

OBSERVATION (ADVANCED) Target

COMMON MISTAKES Correct source, wrong executable Wrong determination of “covering” Poor implementation skills in recursion Wrong concept in local / global variables Wrong output sequence Does the sequence always follow FILO property?

POSSIBLE EXTREME CASE Target