algorithm - Breadth First Search Pseudo Code Understanding -


bfs textbook

i have 2 questions regarding pseduo code above.

  1. what function solution(node) do? how 1 implement it?
  2. on 3rd last line, check if child not in frontier. how 1 check in fifo queue?

  1. solution(node) returns full solution problem instead of node. in pathfinding problem, might return full path start end node

example:

def solution(node):      result = []     while(node.predecessor not none):         result.append(node.predecessor)         node = node.predecessor 
  1. linear search frontier. if isn't possible, still work long check whether node in explored after dequeued, requires memory.

Comments

Popular posts from this blog

networking - Vagrant-provisioned VirtualBox VM is not reachable from Ubuntu host -

c# - ASP.NET Core - There is already an object named 'AspNetRoles' in the database -

android - IllegalStateException: Cannot call this method while RecyclerView is computing a layout or scrolling -