3 ms·
That's brutal. On my first attempt I've matched only 2 shapes. The naive approach is to match each pair, and with 15 pairs total, that's gonna take time, even t
by akomtu 5y ago
That's brutal. On my first attempt I've matched only 2 shapes. The naive approach is to match each pair, and with 15 pairs total, that's gonna take time, even though you need to check only 7.5 pairs on average. A better approach is to "hash" each shape and find the duplicate hash in linear time, which is 3 comparisons on average. The hash can be computed logically, by counting turns the shape takes, or, after looking at hundreds of such shapes, one should be able to "hash" shapes subconsciously, and that will be a dramatic speed up.
I suggest you make a similar problem: matching small isomorphic graphs. I think that's what a lot of software engineeting is really about.