So I prodded this code here and there for a while and ended up using Dijkstra’s shunting-yard algorithm to parse the regex into infix notation, and then using this to make a graph where traversal means accepting the string.
Problem is, now I’m getting runtime error. Why?
From my calculations, allocated space is enough. Besides the two special vertices for start and end of regex, I’m making at most two more vertices for each symbol in the regex. So 400 vertices should be enough, no?
Unless there’s a malformed regex in some input, I can’t see how this would lead the prog into a runtime error. Is it possible that a test case doesn’t conform to the problem statement? Or am I assuming something I shouldn’t about the input cases?