4 ms·
I find myself drawing graphs of state machines a lot and they can help, but I have never considered doing a matrix representation. I have a problem I am working
by tcmart14 4y ago
I find myself drawing graphs of state machines a lot and they can help, but I have never considered doing a matrix representation. I have a problem I am working on with a very bad state machine at work and I think maybe putting in a matrix may help me untangle the madness way better, so I will give it a shot. Thanks!
- zasdffaa 4y agoNever crossed my mind either - seconded.
- adammarples 4y agoIt can also be useful for other reasons, the one that I think of is the interview question involving the knight jumping on the telephone keypad. Using the matrix instead of the graph, you can leverage matrix maths. Multiply the matrix by itself and miraculously you can see where the knight can go in two jumps. Use the power of 7 and sum the rows and you can count how many valid phone numbers are possible from any starting position!