In this Lab, we will first talk about Java Iterators. Specifically, we will introduce the concepts of iterators, then show how they are uesd in programming. We next discuss Breadth-First-Search (BFS), which is a very useful algorithm for traversing graphs. Lastly, we will do some exercise. Specification of Iterator Interface: Iterator.java Code: Comp.java Implementing Java Iterators
Code: Poly.java Code: Num.java Breadth-First Search
Code: GraphBFSedge.java Exercise Based on the GraphBFSedge.java , implementing a main() method, which takes two vertices (V, W) as arguments and prints out one shortest path form V to W. |
||