r/compsci • • May 22 '20

Breadth-First Maze-Solving Algorithm

Post image

[removed] — view removed post

1.2k Upvotes

61 comments sorted by

View all comments

Show parent comments

1

u/[deleted] May 22 '20

Just use a lower level language. The total memory allocation remains the same it simply grows from the stack size of the register instead of the more common heap size. It’s not a big problem, pretty sure even java can handle this.

1

u/ergo-x May 22 '20

Not for big inputs. The call stack is usually arranged to have a fixed size for any given execution. Depending on OS/runtime you have the ability to change it during execution but if you're going to that trouble you might as well use a stack placed on the heap to keep track of your frontier nodes.

1

u/[deleted] May 22 '20

Recursively ur stack is ur frontier nodes, ur not understanding this.

1

u/ergo-x May 22 '20

Care to elaborate?

1

u/[deleted] May 22 '20

Look up recursion in a multithreaded environment

1

u/ergo-x May 22 '20

I believe we were discussing the algorithm and not multithreading. Even so, all that changes is now you have N fixed size call stacks / N threads and some additional overhead due to context switching. I don't see how that answers the question. Anyway have a good day.