{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

# ps04 - CS51 Assignment 4 Asymptotic Performance Due Friday...

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
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. We’ve 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. We’ve 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 assignment–instead, you’ll 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, we’ll be looking at the runtime for searching (in order) for each node in the graph. To get you started, we’ve 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 you’re 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

{[ snackBarMessage ]}

### Page1 / 4

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

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

View Full Document
Ask a homework question - tutors are online