I seem to be in a dilemma when it comes to citation and references. I am implementing and improving an algorithm, and therefore I must state the steps of the algorithm. I would also like to use the definitions they used and there is not much room for paraphrasing. If I paraphrase it, it would be weird since the formulation is very specific. This is a general question: when implementing some algorithm in a paper, would I cite the definitions or should I quote?
The standard dichotomy of quoting vs. paraphrasing makes sense for prose (where an idea can be expressed in many ways), but generally not for mathematical equations: F = ma cannot be meaningfully paraphrased. An algorithm straddles the boundary (which is a source of much intellectual property difficulty): in some ways, after all, an algorithm can be thought of as a rather extensive equation.
A prose-style block quote is not appropriate for an equation, and I would argue that it is likewise not appropriate for an equation. What I instead tend to do in this circumstance is say something like, "Here is the definition of Algorithm X, as reproduced from [citation]:" and then state the definition. If I am adjusting notation or making other such presentation changes, then I will replace "reproduced" with "adapted." This gives the citation and makes it clear that you are using somebody else's formulation, without breaking into a prose-style quote (even better is to place it in a figure or table).
The explanation of the algorithm, on the other hand, is prose, and that you should write yourself, paraphrasing and adapting for the context in which you are discussing the algorithm, which is no doubt different than its original presentation.