One way I find very effective for writing algorithms is to use a state-machine diagram. It's basically a flow-chart, and provides the states (i.e. what to do) as circles, then arrows of...
Type: Posts; User: helloworld922
One way I find very effective for writing algorithms is to use a state-machine diagram. It's basically a flow-chart, and provides the states (i.e. what to do) as circles, then arrows of...
From a quick scan-through it looks like it works. Have you tested it thoroughly? Designing a good test structure is as important if not more important than the actual program itself. Try running it...
The easiest way to do this is with a stack. Every time you see an opening brace/parenthesis/etc. push it onto the stack. Whenever you see a closing brace/parenthesis/etc. see if the item at the top...