Skip to content

[OTHER] Code Duplication: SimpleSort and ExchangeSort are identical #6358

Open
@codingmydna

Description

@codingmydna

What would you like to share?

Summary

The sorting algorithms in SimpleSort.java and ExchangeSort.java appear to be functionally identical, representing code duplication that could be refactored.

Description

While analyzing the sorting algorithms in the repository, I noticed that the implementation for SimpleSort and ExchangeSort is the same.

File links

Both files implement the same O(n^2) sorting logic using a nested loop structure:

To resolve this, I suggest one of the following actions:

  1. Remove one of the classes.
  2. If both names are to be kept for discoverability, add comments to both files clarifying that they are aliases for the same underlying algorithm.

Additional information

I might be missing some context, so please feel free to correct me if this duplication is intentional for a specific reason.

Metadata

Metadata

Assignees

No one assigned

    Labels

    awaiting triageAwaiting triage from a maintainer

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions