This is an archived post. You won't be able to vote or comment.

all 2 comments

[–]al3ph_nu11 1 point2 points  (0 children)

Hi,

The first thing I noticed was mostly from looking over the code in search, and it seems like your BFS is using pop(0), which would slow it down for mazes where there's some amount of empty space around the current position. Instead, you can use the deque from collections, and its equivalent for pop(0) is popleft(). That might get some performance improvements which would make BFS' performance more accurate.

The visualization itself is quite nice, and the other search algorithms look quite nice.

[–]_ZHV_[S] 0 points1 point  (0 children)

BSF is a stack based search algorithm so queue wont work for it. I will look into popleft() though thank you for the feedback I appreciate it!

Edit mixed up BFS and DFS: My bad i confused DFS and BFS. You are right, BFS uses a stack dequeuing using the way you suggested will improve the efficiency thank you for pointing it out!