3 ms·
> What is wrong with writing a state machine using gotos? Nothing. But the thing they want to do -- altering the datastructure on the fly -- is not the best wa
by cabalamat 9y ago
> What is wrong with writing a state machine using gotos?
Nothing. But the thing they want to do -- altering the datastructure on the fly -- is not the best way to solve the problem.
I would solve this by writing two functions: one that creates an array from a binary tree, and one that creates a doubly-linked list from an array.
Would this use up more RAM and take longer to run? Yes
Would the code be easier to understand (and therefore more bug-free)? Yes