News for hackers. Stuff that matters.
Re:Step-by-Step Math by arohner on Wednesday December 02, 2009 @06:57PM (#973332)
Let's treat this as an interview question:

First, I'll assume alpha works similar to a compiler. It parses the text, and generates an AST for the input expression. Your goal is to replace the tree with the 'best' possible equivalent AST. Best here is a fitness function, that provides a score for a given AST. At first glance, we'll say the AST with the smallest number of nodes is optimal.

Then, create a list of legal operations on a subtree. Try an operation, and see if the AST gets better. Repeat.

There are no comments on this comment yet.