This preview shows pages 1–2. Sign up to view the full content.
This preview has intentionally blurred sections. Sign up to view the full version.
View Full Document
Unformatted text preview: CS51 Assignment 4: Asymptotic Performance Due: Friday, March 6th, 2009, 5:00PM Total Points: 45 In this assignment, you will compare and analyze the running times of various graph traversal algorithms. Weve provided modules with code for breadth first search and depth first search in an update to cs51.plt , which you should be prompted to install when you restart DrScheme. Weve also provide various utility functions for timing and plotting your results. The timing and plotting code is in ps4.ss . That should be the only file you modify and hand in. You will not have to write much code for this assignmentinstead, youll have to read our code, evaluate how well it works, and describe what you found. 1 Evaluating BFS, DFS (44 points total) As suggested in lecture, there are performance tradeoffs between DFS and BFS for various applications. Depending on the type of graph and the type of search being performed, one may be far better than the other. In this assignment, well be looking at the runtime for searching (in order) for each node in the graph. To get you started, weve written the module graphsearch , which provides the functions (bfs somegraph root found?) and (dfs somegraph root found?) . somegraph is a graph object, which you saw in the Babbler project. root is the starting node of the search, and found? is a predicate that takes a node as input and returns whether or not the node is the one youre looking for. For example, if you were searching for the node 3, your found? function would be (lambda (somenode) (equal? 3 somenode)) . bfs and dfs return the desired node if it is found, and #f otherwise. Exercise 1. 3 points Using the functions provided by the graph module, make two small graphs. With both dfs and bfs , search each graph for a value other than the starting node, and ensure that they return the proper value....
View
Full
Document
This note was uploaded on 07/26/2009 for the course COMPUTERSC CS51 taught by Professor Gregmorrisett during the Spring '09 term at Harvard.
 Spring '09
 GREGMORRISETT

Click to edit the document details