ps04 - CS51 Assignment 4: Asymptotic Performance Due:...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
This is the end of the preview. Sign up to access the rest of the 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 . 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 trade-offs 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 graph-search , which provides the functions (bfs some-graph root found?) and (dfs some-graph root found?) . some-graph 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 (some-node) (equal? 3 some-node)) . 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.

Page1 / 4

ps04 - CS51 Assignment 4: Asymptotic Performance Due:...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online