Clone Detection

Clone detection finds duplicated code fragments. Clones are classified by how closely the duplicates match:

  • Type 1 — code fragments are identical (ignoring whitespace/comments).
  • Type 2 — structurally and syntactically identical (only identifiers/literals differ).
  • Type 3 — copies with further modifications (added/removed statements).
  • Type 4 — two or more code fragments perform the same computation, implemented through different syntax. Example: two different sorting algorithms with identical semantics.