On Thu, 21 Jun 2007 14:13:12 -0000, in comp.lang.c ,
"bh********@gmail.com" <bh********@gmail.comwrote:
>how to write programmes which minimizes time and space complexities
let suppose for linked lists related programmes
First learn how to write clean code. Unless your code is clean and
easy to read, you will find it hard to optimise.
Then learn how to turn on all your compiler optimisations. The
compiler writer is probably better than you at optimising things.
Then learn how to optimise the algorithms. Note this is nothing to do
with code, its to do with understanding the algorithm and how to make
it more efficient.
Then, if its still not fast enough or small enough for you, profile
the code using specialist tools for your platform.
Then, if and only if you need to, start trying to optimise the code
itself.
Bear in mind that you can have simple, fast or small but rarely all
three at once.
--
Mark McIntyre
"Debugging is twice as hard as writing the code in the first place.
Therefore, if you write the code as cleverly as possible, you are,
by definition, not smart enough to debug it."
--Brian Kernighan