Homework 2, Year 2

Have these done by next class

Basic Problems

Use google if you need help!

1.) What is breadth first search?

2.) What is depth first search?

3.) Why can't depth first graph search be used to write a good chess AI?

4.) If we were to use a search algorithm for a tree of states with no loops, what search algorithm would be best? Why?

5.) What's the difference between tree search and graph search?

Implementation Problems

1.) Write a class called Node that has the following members :
- a Node variable called 'next'
- a boolean variable called 'goal' (defaults to false)

2.) Create 4 nodes objects, a, b, c, and d.

3.) Set :
a.next = b
b.next = c
c.next = d

4.) Set d.goal = true

5.) Create a function called depthFirstSearch(...) that takes in a Node start as a parameter and searches for the goal node.
It should print out each node as it searches and return true
when it finds a solution.