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

node.js - Node js - Trying to send POST request, but it is not loading javascript content -

javascript - Replicate keyboard event with html button -

javascript - Web audio api 5.1 surround example not working in firefox -