Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

You know in my professional career mostly the way I approach these kinds of problems it to just cheat.

What is the runtime complexity of an algorithm? Set it up with varying amounts of data fed to it (or whatever N is) and then time the real thing (or a suitable minimal but complete example).

Then you can instrument or profile the algorithm in any number of different ways to ask what is being called so often.

If you do it right you can really measure what it is doing, and you're getting closer at least to "production" code where you're not just working with pencil and paper but you've got real algorithms running hardware with finite sized caches.

Ultimately it doesn't matter what anyone writes down on pencil and paper if the hardware doesn't agree with you. Usually I measure it first and then work backwards knowing the answer already.



Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: