Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Solution for Exercise 'ex_18' in '3-Solving-Problems-By-Searching18' #360

Open
Flecart opened this issue Sep 12, 2021 · 0 comments · May be fixed by #361
Open

Solution for Exercise 'ex_18' in '3-Solving-Problems-By-Searching18' #360

Flecart opened this issue Sep 12, 2021 · 0 comments · May be fixed by #361

Comments

@Flecart
Copy link

Flecart commented Sep 12, 2021

2:
BFS: 1-2-3-4-5-6-7-8-9-10-11
DFS: 1-2-4-8-9-5-10-11
DLS: 8-9-4-2-5-10-11
3: Bidirectional search would do quite well, the two directions could meet at node 5 or 2. Branching factor of this problem is 2 as every node except node 1 or leaves are related to 3 nodes.
4: Yes, starting from the goal is a lot easier, we just need to decompose the goal number with the following algorithm
5: start from the goal node.

solution <- empty_list
while goal != 1
do
if goal is even then put Left into solution; goal <- goal/2
else if goal is odd then put Right into solution; goal <- (goal-1)/2
finish
reverse order of solution
print solution

Flecart added a commit to Flecart/aima-exercises that referenced this issue Sep 12, 2021
@Flecart Flecart linked a pull request Sep 12, 2021 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant