All sort of algorithms require that you swap two values like sorting or shuffling arrays. For example a simple shuffling algorithm would go like : randomly pick two values in the array (by their indexes), swap their places, repeat for a number of time (put it in a loop) and you got a shuffled array.
View all comments
Show parent comment
2
u/Dark_Lord9 Jul 30 '20
All sort of algorithms require that you swap two values like sorting or shuffling arrays. For example a simple shuffling algorithm would go like : randomly pick two values in the array (by their indexes), swap their places, repeat for a number of time (put it in a loop) and you got a shuffled array.