1 Algorithm Strategies. 2 Introduction zAlgorithms may be grouped into categories or types. zThis is based upon how they go about finding a solution to.

Slides:



Advertisements
Similar presentations
Algorithm Design Techniques
Advertisements

Heuristics, and what to do if you dont know what to do Carl Hultquist.
Review: Search problem formulation
Heuristic Search techniques
Algorithm Design Methods (I) Fall 2003 CSE, POSTECH.
Introduction to Algorithms Quicksort
Informed search algorithms
Artificial Intelligence By Mr. Ejaz CIIT Sahiwal.
Chapter 3 Brute Force Brute force is a straightforward approach to solving a problem, usually directly based on the problem’s statement and definitions.
Back to Sorting – More efficient sorting algorithms.
Traveling Salesperson Problem
CSE 390B: Graph Algorithms Based on CSE 373 slides by Jessica Miller, Ruth Anderson 1.
Types of Algorithms.
Anany Levitin ACM SIGCSE 1999SIG. Outline Introduction Four General Design Techniques A Test of Generality Further Refinements Conclusion.
Algorithms + L. Grewe.
October 1, 2012Introduction to Artificial Intelligence Lecture 8: Search in State Spaces II 1 A General Backtracking Algorithm Let us say that we can formulate.
Lecture 12: Revision Lecture Dr John Levine Algorithms and Complexity March 27th 2006.
CS 480 Lec 3 Sept 11, 09 Goals: Chapter 3 (uninformed search) project # 1 and # 2 Chapter 4 (heuristic search)
CS 206 Introduction to Computer Science II 11 / 07 / 2008 Instructor: Michael Eckmann.
Quicksort Quicksort     29  9.
Best-First Search: Agendas
Outline 1. General Design and Problem Solving Strategies 2. More about Dynamic Programming – Example: Edit Distance 3. Backtracking (if there is time)
Algorithm Strategies Nelson Padua-Perez Chau-Wen Tseng Department of Computer Science University of Maryland, College Park.
Introduction to Analysis of Algorithms
CS 206 Introduction to Computer Science II 11 / 10 / 2008 Instructor: Michael Eckmann.
Quicksort.
Intelligent Agents What is the basic framework we use to construct intelligent programs?
CS 206 Introduction to Computer Science II 12 / 03 / 2008 Instructor: Michael Eckmann.
CS 206 Introduction to Computer Science II 11 / 05 / 2008 Instructor: Michael Eckmann.
Summary of Algo Analysis / Slide 1 Algorithm complexity * Bounds are for the algorithms, rather than programs n programs are just implementations of an.
1 Algorithm Design Techniques Greedy algorithms Divide and conquer Dynamic programming Randomized algorithms Backtracking.
Backtracking.
Instructor: Dr. Sahar Shabanah Fall Lectures ST, 9:30 pm-11:00 pm Text book: M. T. Goodrich and R. Tamassia, “Data Structures and Algorithms in.
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.
Exploring Algorithms Traveling Salesperson Problem I: Brute Force, Greedy, and Heuristics Except as otherwise noted, the content of this presentation is.
Fundamentals of Algorithms MCS - 2 Lecture # 7
Design and Analysis of Algorithms - Chapter 111 How to tackle those difficult problems... There are two principal approaches to tackling NP-hard problems.
Chapter 12 Coping with the Limitations of Algorithm Power Copyright © 2007 Pearson Addison-Wesley. All rights reserved.
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.
CS 415 – A.I. Slide Set 5. Chapter 3 Structures and Strategies for State Space Search – Predicate Calculus: provides a means of describing objects and.
Christopher Moh 2005 Competition Programming Analyzing and Solving problems.
CS 206 Introduction to Computer Science II 04 / 22 / 2009 Instructor: Michael Eckmann.
Algorithm Design Methods (II) Fall 2003 CSE, POSTECH.
Divide and Conquer Optimization problem: z = max{cx : x  S}
For Friday Read chapter 4, sections 1 and 2 Homework –Chapter 3, exercise 7 –May be done in groups.
Sorting.
Types of Algorithms. 2 Algorithm classification Algorithms that use a similar problem-solving approach can be grouped together We’ll talk about a classification.
Week 10 - Friday.  What did we talk about last time?  Graph representations  Adjacency matrix  Adjacency lists  Depth first search.
Design and Analysis of Algorithms (09 Credits / 5 hours per week) Sixth Semester: Computer Science & Engineering M.B.Chandak
1 Recursive algorithms Recursive solution: solve a smaller version of the problem and combine the smaller solutions. Example: to find the largest element.
Fahiem Bacchus © 2005 University of Toronto 1 CSC384: Intro to Artificial Intelligence Search II ● Announcements.
CS 721 Project Implementation of Hypergraph Edge Covering Algorithms By David Leung ( )
CMPT 238 Data Structures More on Sorting: Merge Sort and Quicksort.
Various Problem Solving Approaches. Problem solving by analogy Very often problems can be solved by looking at similar problems. For example, consider.
Design and Analysis of Algorithms (09 Credits / 5 hours per week)
BackTracking CS255.
Sorting by Tammy Bailey
Artificial Intelligence Problem solving by searching CSC 361
Types of Algorithms.
Types of Algorithms.
A General Backtracking Algorithm
A General Backtracking Algorithm
Lecture 3: Environs and Algorithms
Backtracking and Branch-and-Bound
CPSC 322 Introduction to Artificial Intelligence
Types of Algorithms.
Major Design Strategies
INTRODUCTION TO ALOGORITHM DESIGN STRATEGIES
Major Design Strategies
Algorithm Course Algorithms Lecture 3 Sorting Algorithm-1
Presentation transcript:

1 Algorithm Strategies

2 Introduction zAlgorithms may be grouped into categories or types. zThis is based upon how they go about finding a solution to a particular problem. zAs examples, we’ll be using sorting and graph algorithms.

3 Introduction II zAt any time, these algorithms should be viewed as representing a STATE of the problem. zA step in the algorithm (or a decision) represents a transition from one state to another. zThus, these algorithms can be thought of as state space searches.

4 Brute Force Algorithms zThese examine all possible solutions to a problem, and then pick the best one. zExample: Let’s sort an array of n values by generating all possible orderings of the n elements and selecting the one that is in order. zExample II: Let’s solve the 8-puzzle problem by generating the entire search space and locating a path to the goal.

5 Brute Force Discussion zAdvantages: yCan be fairly easy to implement zDisadvantages: yAre usually too time consuming to be practical. zLook at the 8-Puzzle example search space to 4 levels...

6 Backtracking zSimilar to Brute Force, except search in a particular order. zPerhaps using a Depth First or Breadth First Search. zExamples: yTesting for Graph Connectivity ySolving the 8-Puzzle problem with a Breadth First Search of the search space.

7 Backtracking Discussion zAdvantages yWill stop generating states when a solution is found. yA BFS will find the minimum number of steps to a solution. zDisadvantages yWill still search the entire space in the worst case. yDoesn’t apply well to something like sorting.

8 Branch and Bound zAgain, similar to backtracking, except we do not examine all possibilities. zWe eliminate those options that are infeasible or for which a solution has been found which is guaranteed to be better. zExample: The cabbage-goat-wolf problem would not examine any state that would cause the cabbage or goat to be eaten.

9 Branch and Bound Discussion zAdvantages: yLikely to be even faster as transitions that would not lead to an optimal solution are not explored. zDisadvantages: yStill could search the whole space in the worst case. zAs a general rule, you always look for ways to bound the search space.

10 Greedy Algorithms zFrom each state, the “best” option is chosen. zOnce made a decision is not re-examined. zExamples: yDijkstra’s Algorithm is a greedy algorithm in that it always adds the next vertex of least cost. yA Selection Sort could be viewed as a greedy algorithm as well.

11 Greedy Discussion zAdvantages: yDrastically reduces the number of states. zDisadvantages: yHow to define “best”? yRarely produces an optimal solution when “best” must be determined by looking at succeeding states.

12 Divide and Conquer zBreak the problem to be solved into sub- problems, which can be solved easier and combined to form the complete solution. zExamples: yMerge Sort breaks a list of values to sort into smaller lists and then combines the list. yA Binary Search is also an example of a divide and conquer strategy.

13 Divide and Conquer Discussion zAdvantages: yOften easier to solve smaller problems and put their solutions together, rather than solve entire problem. yConsider brute force sorting of an array of 100 elements versus brute force sorting of 5 elements 20 times and merging the results. zDisadvantages: yNot always possible to break the problem down into discrete steps.

14 The End Slide z