For an IEEE submission I am not allowed to use
algorithm package. They recommend to use
algorithmic package. I am not able to add caption in the
algorithmic package. This and this answer solves the problem using
algorithm package, which is of no use to me.
I am allowed to use
algorithmicx package too. I am using