Christopher Moh 2005 Competition Programming Analyzing and Solving problems.

Slides:



Advertisements
Similar presentations
Algorithm Design Techniques
Advertisements

An Introduction to Artificial Intelligence
Transform and Conquer Chapter 6. Transform and Conquer Solve problem by transforming into: a more convenient instance of the same problem (instance simplification)
Lecture 24 Coping with NPC and Unsolvable problems. When a problem is unsolvable, that's generally very bad news: it means there is no general algorithm.
Anany Levitin ACM SIGCSE 1999SIG. Outline Introduction Four General Design Techniques A Test of Generality Further Refinements Conclusion.
Lecture 12: Revision Lecture Dr John Levine Algorithms and Complexity March 27th 2006.
Chapter 5 Decrease and Conquer. Homework 7 hw7 (due 3/17) hw7 (due 3/17) –page 127 question 5 –page 132 questions 5 and 6 –page 137 questions 5 and 6.
CS 206 Introduction to Computer Science II 11 / 07 / 2008 Instructor: Michael Eckmann.
UNINFORMED SEARCH Problem - solving agents Example : Romania  On holiday in Romania ; currently in Arad.  Flight leaves tomorrow from Bucharest.
Chapter 6: Transform and Conquer
Algorithm Strategies Nelson Padua-Perez Chau-Wen Tseng Department of Computer Science University of Maryland, College Park.
EDA (CS286.5b) Day 2 Covering. Why covering now? Nice/simple cost model problem can be solved well (somewhat clever solution) general/powerful technique.
Blind Search-Part 2 Ref: Chapter 2. Search Trees The search for a solution can be described by a tree - each node represents one state. The path from.
CS 206 Introduction to Computer Science II 12 / 10 / 2008 Instructor: Michael Eckmann.
Backtracking Reading Material: Chapter 13, Sections 1, 2, 4, and 5.
Backtracking.
Dynamic Programming Introduction to Algorithms Dynamic Programming CSE 680 Prof. Roger Crawfis.
Busby, Dodge, Fleming, and Negrusa. Backtracking Algorithm Is used to solve problems for which a sequence of objects is to be selected from a set such.
ADA: 10. MSTs1 Objective o look at two algorithms for finding mimimum spanning trees (MSTs) over graphs Prim's algorithm, Kruskal's algorithm Algorithm.
Stochastic Algorithms Some of the fastest known algorithms for certain tasks rely on chance Stochastic/Randomized Algorithms Two common variations – Monte.
Analysis of Algorithms
Algorithm Evaluation. What’s an algorithm? a clearly specified set of simple instructions to be followed to solve a problem a way of doing something What.
Dynamic Programming. What is dynamic programming? Break problem into subproblems Work backwards Can use ‘recursion’ ‘Programming’ - a mathematical term.
Design and Analysis of Algorithms - Chapter 111 How to tackle those difficult problems... There are two principal approaches to tackling NP-hard problems.
Télécom 2A – Algo Complexity (1) Time Complexity and the divide and conquer strategy Or : how to measure algorithm run-time And : design efficient algorithms.
Major objective of this course is: Design and analysis of modern algorithms Different variants Accuracy Efficiency Comparing efficiencies Motivation thinking.
1 Boosting-based parse re-ranking with subtree features Taku Kudo Jun Suzuki Hideki Isozaki NTT Communication Science Labs.
Honors Track: Competitive Programming & Problem Solving Optimization Problems Kevin Verbeek.
Recursive Back Tracking & Dynamic Programming Lecture 7.
For Friday Finish reading chapter 4 Homework: –Lisp handout 4.
For Monday Read chapter 4, section 1 No homework..
Review: Tree search Initialize the frontier using the starting state While the frontier is not empty – Choose a frontier node to expand according to search.
Lecture 3: Uninformed Search
CAS 721 Course Project Minimum Weighted Clique Cover of Test Set By Wei He ( )
Advanced Algorithm Design and Analysis (Lecture 14) SW5 fall 2004 Simonas Šaltenis E1-215b
Course Review Fundamental Structures of Computer Science Margaret Reid-Miller 29 April 2004.
Graphs. Graphs Similar to the graphs you’ve known since the 5 th grade: line graphs, bar graphs, etc., but more general. Those mathematical graphs are.
Computer Sciences Department1.  Property 1: each node can have up to two successor nodes (children)  The predecessor node of a node is called its.
1. 2 Outline of Ch 4 Best-first search Greedy best-first search A * search Heuristics Functions Local search algorithms Hill-climbing search Simulated.
CSE 340: Review (at last!) Measuring The Complexity Complexity is a function of the size of the input O() Ω() Θ() Complexity Analysis “same order” Order.
Chapter 13 Backtracking Introduction The 3-coloring problem
Graph Search II GAM 376 Robin Burke. Outline Homework #3 Graph search review DFS, BFS A* search Iterative beam search IA* search Search in turn-based.
ICS 353: Design and Analysis of Algorithms Backtracking King Fahd University of Petroleum & Minerals Information & Computer Science Department.
Onlinedeeneislam.blogspot.com1 Design and Analysis of Algorithms Slide # 1 Download From
Course Review Fundamental Structures of Computer Science Margaret Reid-Miller 28 April 2005.
Chapter 9 Recursion © 2006 Pearson Education Inc., Upper Saddle River, NJ. All rights reserved.
CALTECH CS137 Fall DeHon 1 CS137: Electronic Design Automation Day 2: September 28, 2005 Covering.
CSE 589 Applied Algorithms Spring 1999 Prim’s Algorithm for MST Load Balance Spanning Tree Hamiltonian Path.
For Monday Read chapter 4 exercise 1 No homework.
CMPT 438 Algorithms.
Algorithms and Problem Solving
BackTracking CS255.
Weighted Interval Scheduling
CS200: Algorithm Analysis
Final Exam Review 6 December 2010.
Dynamic Programming.
Dynamic Programming.
Data Structures and Algorithms
Objective of This Course
Searching for Solutions
Chapter 6: Transform and Conquer
Backtracking and Branch-and-Bound
Dynamic Programming II DP over Intervals
Alan Kuhnle*, Victoria G. Crawford, and My T. Thai
ICS 353: Design and Analysis of Algorithms
Major Design Strategies
INTRODUCTION TO ALOGORITHM DESIGN STRATEGIES
Constraint Satisfaction Problems
Dynamic Programming.
Major Design Strategies
Presentation transcript:

Christopher Moh 2005 Competition Programming Analyzing and Solving problems

Christopher Moh 2005 Steps in solving a problem Reading the problem Formulation of a solution Implementation the solution Testing the solution

Christopher Moh 2005 Reading the problem Read the WHOLE problem! May have subtle details in problem descriptions that are essential to solve the problem efficiently Examining Time and Space constraints Watching out for obvious properties

Christopher Moh 2005 Time and Space Constraints Time Constraints usually are more important than Space Constraints What kind of algorithm works? Good average case? Good worst case? Gives an idea of the kind of algorithm that solves the problem E.g. Huge graph problems usually imply some linear-time traversal solution

Christopher Moh 2005 Time and Space Constraints Does the problem specify the size of the test cases? If there are only one or two test cases that are huge compared to the rest… DON’T SOLVE FOR THESE TEST CASES IF YOU DON’T KNOW THE ADVANCED ALGORITHM There usually will be a basic algorithm that will solve the rest with suitable optimizations and data structures

Christopher Moh 2005 Properties I What unique properties are explicitly stated or easily implied? Unique Numbers? At most one path between any two nodes implies a forest of trees Exactly one path between any two nodes implies a tree No return path may imply a DAG Classification in a system of “black” and “white” etc may imply a bipartite graph

Christopher Moh 2005 Formulation How can I solve this problem? As a Graph problem? As a DP problem? Sorting problem? Clever data structures? Using unique properties of the problem? Brute Force?

Christopher Moh 2005 Breaking down problems Can this problem be broken down into a decent number of sub-problems that can be combined to solve the problem? Is there an inherent, or maybe a subtle implied order that we can use? Can I use a solution to a similar problem of a smaller dimension?

Christopher Moh 2005 Properties II Are there number properties I can use? Is this a special graph with unique properties e.g. trees, DAGs, etc.? Is sorting allowed and what advantage can sorting give me? Does a greedy solution work?

Christopher Moh 2005 Implementation Data Structures Can I get away with using simple data structures and still beat the time limit? If not, what works? Heaps? Interval trees? Cumulative Sum data structures? [ See IOI 2001 Day 1 Q1 ]

Christopher Moh 2005 Implementation Dynamic Programming solution What do I have to keep track of? How can I evaluate the recurrence relation? How should my loops be oriented? Do I have to keep track of the solution if I need to backtrack to output the actual solution instead of the optimal result? Should I use memoization? Is there an important space constraint?

Christopher Moh 2005 Implementation Graph solutions Should I use an adjacency list or a matrix? Space and time constraints Is my graph formulation solvable in polynomial time? How many vertices/edges does my formulation produce? Is there a way to compress vertices/edges to improve runtime while still preserving accuracy of output?

Christopher Moh 2005 Implementation Brute Force solutions What pruning methods are available? Are there ways to generate output without going through redundancy or irrelevant search areas? [ See IOI 2001 Day 2 Q3 ] Can a simple backtracking work? Or perhaps more advanced search methods e.g. Iterative Deepening, A* search are needed?

Christopher Moh 2005 Testing Testing for Accuracy with extreme cases Isolated vertices? Complete graphs? Completely negative numbers? Testing for Speed How fast does the solution run when faced with a huge input?