------ art_733_10353413.1151407360745 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline On 6/26/06, Suraj N. Kurapati <skurapat / ucsc.edu> wrote: > > -----BEGIN PGP SIGNED MESSAGE----- > Hash: SHA1 > > Sean Carley wrote: > > My solution does have one aspect I haven't noticed in everyone's great > > submissions so it might be illustrative, if nothing else - I wrote my > > implementation test first. Other than that, there isn't too much > > novelty in my solution. > > IMHO there is too much re-computation of nth_row() in this > implementation. See for yourself with this patch: > Suraj, You are absolutely right that my implementation is not the most efficient. You could even call it wasteful. The thing is, I believe you should never optimize prematurely. Without specific data telling me my solution is too slow, I would almost never rewrite it to be faster. I would make changes to make things more clear but not to make them faster. I wouldn't optimize until I knew the speed requirements. For example, if the client came back and said we need to complete the pascal triangle of 1000 in under 10 seconds, then I would start profiling to find out how to make that happen. Sean ------ art_733_10353413.1151407360745--