If you don't want all your hard work spent developing your algorithms used by someone else, simply don't release your source code. True, someone could reverse engineer your executable and get some clue as to how your algorithm works. This isn't so bad, for all they are getting is a clue. Your competitor would still have to write his own code to make use of your invention. If he simply cut and paste, he would be violating the copyright.
Patents are the equivalent of copyrights for physical machines.
Since software can be copyrighted, it is going way too far to let patents lock up the concepts used in writing the code. How about this. I was working with a business guy, just starting out in a mom and pop business. One day I typed swapon -a on the firewall, a firewall which I had set up and even paid for from the ground up to masquerade the office onto an IP address on the saturated T1. The point is, I routinely turned on and off swap space by hand, a technique that improved performance immensely on Linux 2.0.34.