My question is very similar to this one, but I'm curious about algorithms. The accepted answer states that:

Mathematical equations are not normally considered subject to plagiarism ...

I am wondering if the same would apply to algorithms. I think they are very similar to equations, except for the use of sentences (in the case of pseudo code). If it is made clear where the algorithm came from, would it be ok to copy?

  • 2
    If it is made clear where the algorithm came from ...so...you mean citing your source?
    – tonysdg
    Commented Dec 21, 2016 at 6:35
  • Yes. That is what I mean. I guess to rephrase the question: Is it plagiarism to cite the source of an algorithm and include it verbatim in a paper?
    – McAngus
    Commented Dec 21, 2016 at 6:37
  • 7
    My understanding is that if you're (properly) citing your source (the original author of the algorithm) and not claiming the algorithm as your own, you're not plagiarizing. I don't see why this would be any different than citing any other idea that's not your own. That said, hang out for a bit and see if anyone else has advice too.
    – tonysdg
    Commented Dec 21, 2016 at 6:41
  • 2
    I think that depends on the novelty and length/complexity of the algorithm, just as it would for prose. Writing out all four lines of selection sort verbatim isn't plagiarism; that's like quoting a fact everyone knows. Writing out a 25-line algorithm verbatim would be like quoting verbatim an entire paragraph of text; acceptable, but only in moderation. Writing out a verbatim description of an algorithm that takes 10 pages to explain properly is like copying out an whole chapter of Harry Potter --- maybe not plagiarism, but probably a copyright violation. (Yes, there are such algorithms.)
    – JeffE
    Commented Dec 21, 2016 at 6:43

4 Answers 4


Plagiarism is passing someone else's work as your own. If the source is referenced, then there is no plagiarism.

Quoting the whole algorithm verbatim may be considered as bad writing style, may be against a particular journal's rules, or may simply demonstrate a certain lack of creativity. However, this is not a plagiarism, as long as the source is cited.

  • In addition, copying a whole algorithm might also be a copyright violation, even if the source is attributed. Commented Dec 21, 2016 at 15:32
  • 3
    @lighthousekeeper: The algorithm shouldn't be copyrightable, although a specific description of it (in words, in code, pseudocode, or whatever) could be subject to copyright.
    – Buzz
    Commented Dec 21, 2016 at 19:56

@DmitrySavostyanov is right in that what matters is that you reference where you got the algorithm from. If you do so, then copying it verbatim is in essence a quote, not plagiarism.

I disagree with him, though, on whether it is good or bad style to copy algorithms verbatim. Algorithms -- especially when giving in short "pseudo-algorithm" form, are concise, technical statements in much the same way as formulas are. There is typically no literary component to it. As such, there is little leeway in rephrasing something to make it your own, other than the gratuitous use of different variable or function names. The latter, however, is not helpful, but rather only serves to confuse readers trying to compare papers. Consequently, I'm all for copying verbatim, as long as it is clear where it comes from.

So, say something like "The problem above is easily solvers by the algorithm of Miller and Smith [13], which is reproduced in the following: [...]".

  • Algorithms...are concise, technical statements — Not necessarily concise, no.
    – JeffE
    Commented Dec 21, 2016 at 14:04
  • Well, but they're intended to, at least. If they're not, they're poorly written. Commented Dec 25, 2016 at 11:57
  • Not even close! Some algorithms are just inherently complicated. Even Ikea instructions sometimes run to dozens of pages, not because they're poorly written, but because they have to.
    – JeffE
    Commented Dec 25, 2016 at 14:53
  • But then we're talking about different meanings of the word "concise". Wiktionary says "brief, yet including all important information" where I take "brief" as "as short as necessary", not "short in absolute terms". Commented Dec 27, 2016 at 21:03

It may not be plagiarism, but you would be called to task to justify why you are doing it in most cases. My experience has been that you don't need to show an documented algorithm so much as say why you are using it and where someone can find more information on it. So if I'm working on a paper I may say something like,

In order to explore the transmission of memes through the social network, we first assumed that they arrived at highly influential (i.e. well connected) nodes using the shortest path from the source. These paths were identified using Dijkstra's algorithm for finding shortest paths between nodes in a graph (Dijkstra, 1959).

At which point nothing more really needs to be said on the algorithm itself. In fact, depending on the audience, I may have said too much.

Generally writing out the algorithm in full usually means that it's being explained in depth (i.e. a textbook approach), there isn't an expectation that your audience would be familiar with it in any way, or you are doing so to demonstrate a fundamental that needs to be deconstructed as part of a proof. Even then, about the only time you are really going to want to write the algorithm out in full is if you are developing a textbook or teaching materials on it.


First, we should discuss the issue concerning mathematical equations. It is general accepted that mathematical equations must be treated as a dense text. Hence, it should be very clear that these equations, definitions, theorems, come from a source, and the source have to be cited before using the text.

For algorithms, the situation is almost the same. A sufficiently small algorithm may be treated similar to a large equation. You may include it if you make it clear that the algorithm text is not yours, by using the quotes or the italic style, depending on citation style. However, for large algorithms, there is a difference because of copyright of the journal. Hence, a large algorithm should be treated like a figure. You need to get permission from the author and from the publisher. Furthermore, because an algorithm is so large, it will look like you are padding your paper and reviewers don’t like this. You should think twice about including a large algorithm from someone else.

  • Do you mean the algorithm, or the description of the algorithm? The two are very different for intellectual property purposes.
    – Buzz
    Commented Dec 22, 2016 at 14:34
  • The algorithm, of course.
    – Nikey Mike
    Commented Dec 23, 2016 at 13:06
  • The algorithm itself is not subject to the kind if intellectual property protections you suggest.
    – Buzz
    Commented Dec 23, 2016 at 13:10
  • Copying a large part of a published paper is limited by the copyright.
    – Nikey Mike
    Commented Dec 23, 2016 at 13:17
  • Copyright covers the expression of ideas, not the ideas themselves. The algorithm itself is an idea. If the descriptions of the algorithm is reworded, it can be copied freely without copyright restrictions. As a procedure, an agorithm could be eligible for patent protection, but that's very different. There is also the necessity of giving proper credit, but again, that has nothing to do with copyright.
    – Buzz
    Commented Dec 23, 2016 at 13:38

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .