Because you can't directly patent an algorithm, software patents use all sorts of fascinating workarounds to pretend like they've patented something else instead. A typical software patent will include the same patent claims written several different ways, based on legal precedents used with software patents in the past. A patent on an algorithm for fooing bars via steps A, B, and C, with the additional claim of doing D while fooing, might have one set of claims:
1. A method for fooing bars, comprising A, B, and C.
2. A method in accordance with claim 1, wherein said fooing further comprises doing D.
3. A system for fooing bars, comprising A, B, and C.
4. A system in accordance with claim 3, wherein said fooing further comprises doing D.
5. A computer program product for fooing bars, comprising A, B, and C.
6. A computer program product in accordance with claim 5, wherein said fooing further comprises doing D.
This covers several different legal precedents; even if "method" gets invalidated as an approach, the patent may still work under the "system" or "computer program product" theories.
This gets taken to a ridiculous extreme; many such patents describe the computer program product as a physical object consisting of bits on a medium such as a CD or disk, and include as a figure an illustration of such a medium.