TheAlgorithms/Java

[FEATURE REQUEST]: Add Shuffling Algorithm

Opened this issue · 3 comments

What would you like to Propose?

I propose to implement a shuffling algorithm that randomizes the order of elements in a list, effectively destroying any existing order. This algorithm will ensure that all possible permutations of the list are equally likely, assuming a fair source of randomness.

Issue details

Implementation:

  1. Develop a function that accepts a list and returns a shuffled version.
  2. Ensure uniform distribution of permutations by leveraging a reliable randomization method.

Additional Information

No response

@siriak Please assign this issue to me.

Add Shuffling Algorithm

What Would you like to Propose?
I would like to propose the addition of the Shuffling Algorithm (such as Fisher-Yates) to the repository. This algorithm would be useful for providing a randomized order of the elements in a given list, ensuring randomness. Implementing this in Java would prove to be a useful addition to the existing repository.

Issue Details
The Shuffling Algorithm works by randomizing elements in a list, effectively destroying any previous orders and making every possible order of elements equal in likelihood to one another. The Fisher-Yates algorithm has a time complexity of O(n) and space complexity of O(1).

Additional Information
The proposed implementation will be using the Fisher-Yates Algorithm in order to shuffle finite sequences and order elements by picking them from a list one by one until there are none left, therefore creating unbiased permutations where each possible combination is as likely as another.

[FEATURE REQUEST]: Add Shuffling Algorithm #5635

@siriak
Sorry for the late response.
Thanks for assigning this to me I am on it.