While solving problem I used to think for an idea,then I will code it.

But i never thought about the correctness of algorithm.

What is correctness of algorithm ?

How should I prove it?

Is it necessary for every problem.Any one give me link or examples how to prove the correctness of algorithm.

You can refer to the MIT - open courseware(OCW) 42.

It is based on proofs

MIT is Ok.