algorithms/python/shuffle
sundowndev b01b4cbe79 python: init shuffle algorithm 2019-09-26 10:12:55 +02:00
..
__pycache__ python: init shuffle algorithm 2019-09-26 10:12:55 +02:00
README.md python: init shuffle algorithm 2019-09-26 10:12:55 +02:00
solution.py python: init shuffle algorithm 2019-09-26 10:12:55 +02:00

README.md

How to shuffle the characters in a string in JavaScript ?

e.g. Given "ABCDEFG", return something like "GEFBDCA".

print(shuffle("the quick brown fox jumps over the lazy dog"));
//-> "veolrm  hth  ke opynug tusbxq ocrad ofeizwj"

print(shuffle("the quick brown fox jumps over the lazy dog"));
//-> "o dt hutpe u iqrxj  yaenbwoolhsvmkcger ozf "
  • Best performance case: O(n)
  • Worst performance case: O(n log n)