It was a little time since my class of algorithms was at school, so forgive me if my terminology is not accurate.
I have a series of actions that, at startup, create some kind of desired state (this is basically a set of steps for reproducing the error, but it does not matter for this question).
My goal is to find the shortest series of steps that still create the desired state. Any given step may be unnecessary, so I try to remove them as efficiently as possible.
I want to keep the order of the steps (so I can delete the steps, but not reorder them).
The naive approach that I take is to take the entire series and try to delete each action. If I successfully delete one action (without changing the final state), I will start from the beginning of the series. It should be O (n ^ 2) in the worst case.
I am starting to play in order to make it more efficient, but I am sure that this is a problem. Unfortunately, I donβt know for sure that for Google the series is not really a βpathβ, so I cannot use path reduction algorithms. Any help β even just giving me some search terms β would be helpful.
Update: several people have indicated that even my naive algorithm will not find the shortest solution. This is a good point, so let me reconsider my question a bit: any ideas on approximate algorithms for the same problem? I would prefer a short solution that would be closer to the shortest quick solution than take a very long time to guarantee an absolute shortest series. Thanks!
source share