# Can I use publicly mentioned algorithms for writing programs?

I want to write a program that solves sudoku.

So, I found some sudoku algorithms on Wikipedia. Can I use them or do I need to develop my own algorithm? Also, do I need to ask the specific license holder's permission?.. If so, how would I go about obtaining that permission?

• You can solve Sudoku in a few seconds in a slow language (e.g. Perl) by a simple backtracking algorithm: just try the first number that fits in the next open box, and when you can't proceed, backup and try the next number. Jul 23, 2011 at 15:58

Disclaimer: I'm absolutely not a lawyer, of patents or anything else. Feel free to ignore me in the interest of your [w|h]ealth

However, my understanding is that if you are looking at pseduo-code of an algorithm via a public-domain such as Wikipedia, then you can take into account the decisions made in the pseduo-code as input for when you come to code your own implementation.

On this assumption I learnt programming, using a book of sorting routines. There's no point in re-inventing the wheel.

However, in wikipedia, if it's a code sample, rather than pseudo-code and has a specific copyright notice against it - it's probably common courtesy to drop the copyright holder an email to ask them about it - even if just to make yourself feel better. Also, if it IS program-specific code, turn it into pseudo-code yourself and strip out anything extraneous to the problem. That way you'll have pseduo-code, and you'll have learnt a lot about the algorithm

• Commenting only on the Wikipedia part of things: It's not PD, it's all either GFDL or CC-BY3. Algorithms in itself can't be copyrighted, thought the can, alas, be patented, so implementing a well-known algorithm will never be a copyright infringement. Jul 23, 2011 at 16:01
• To complicate matters, I don't think patents restrict you at all from describing the invention which means that you can describe a patented algorithm in enough detail to implement as long as you don't actually implement it. I believe I've seen pseudocode descriptions of patented algorithms. (I am not a lawyer and could well be wrong.)
– user53141
Jul 3, 2012 at 23:02

If you use the algorithm, but write your own code, this isn't a copyright infringement. (by the way,if it's from Wikipedia, all content is CC-BY-SA. Snipped from their website:

Permission is granted to copy, distribute and/or modify Wikipedia's text under the terms of the Creative Commons Attribution-ShareAlike 3.0 Unported License and, unless otherwise noted, the GNU Free Documentation License. unversioned, with no invariant sections, front-cover texts, or back-cover texts. A copy of the Creative Commons Attribution-ShareAlike 3.0 Unported License is included in the section entitled "Wikipedia:Text of Creative Commons Attribution-ShareAlike 3.0 Unported License" A copy of the GNU Free Documentation License is included in the section entitled "GNU Free Documentation License". Content on Wikipedia is covered by disclaimers.

http://en.wikipedia.org/wiki/Wikipedia:COPY

This means you can even copy paste it straight as long as you release your code under a compatible licence

• I meant to say they are mentioned in wikipedia.. Jul 23, 2011 at 16:20

I would say there's no ethical problem with using publicly displayed code. Why did the author(s) of the code put it out in public, if not for someone to see and copy? The same would be true for publicly-described algorithms. Why put them out there if you don't want others to use them?

In the USA (and wherever the USA federal law enforcement can reach) using publicly displayed code may get you into copyright trouble. Using publicly described algorithms may constitute patent infringement. But the trouble would be legal, not ethical. USA law seems to have come unstuck from reality, ethics and economics. It's certainly possible for some twisted desparate troll to put a patented algorithm out there, and then sue people who used that algorithm. The whole of morality is not contained within the law, especially USA law.

• In case it's about patented algorithms, keep in mind though you might be infringing on patents, if there is no clear indication that the algorithm was patented, you are not willfully infringing. If you are fairly small, you are not likely to be targeted by patent trolls though. Jul 23, 2011 at 20:56

You always should honour the licence. It is not probable that someone will find out, but its the ethical way to do things. If there is no license displayed, you should at least try to contact the author using guestbook or email. Big sites like wiki etc. have these issues taken care of in some global portal content licenses.

In case someone is still interested in code available under some permissive licence, I offer mine (currently under MIT license):

Sudoku - Algoritmy.net

The general idea about software, algorithms and implementation details is:

• the more you produce something that is abstract and without significant details, like an mathematical algorithm, the less you are likely to have the right to patent that
• the more you can produce a detailed implementation the higher the chances are that you can protect your intellectual property with a patent.

For example if you know about JPEG, it's a general file container for bitmap images, its standard says nothing clear about any implementation details, if you just follow the JPEG standard you can't write useful code because it's too generic and does not gives you the implementation details that you need to read or write from an actual JPEG file.

However this kind of things is possible http://www.google.com/patents/US6724939 because it's 1 specific way of implementing this algorithm.

You can find some extra examples here http://en.wikipedia.org/wiki/Patentable_subject_matter

Remember that patenting means that a person registers that intellectual property, it's not about selling and paying for something, in fact you can just choose to patent something and not asking for royalty even if peoples uses that, you can patent something and prohibit the use of that technology without giving licenses, you can patent something and choose to sell licenses to use that technology.

If you find code with an "unknow source" your best chance is to change at least a little piece of code, rearrange the text or something like that.

Yes plus enough filler to make this answer long enough as long as you comply with the declared license.