Skip to content

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

Open
@Flecart

Description

@Flecart

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions