In this article, we have explored two approaches to shuffle an array. The first approach uses an auxiliary array while the second approach is in-place and is known as Fisher Yates Algorithm.
Table of content:
IntroductionApproach 1: Using auxiliary arrayApproach 2:
Fisher Yates AlgorithmLet us get started.
Introduction
Given an array, we need to shuffle it randomly. All possible permutations of the array elements must be equally likely to be produced after shuffling. In this article, we dis...
Published on August 23, 2021 06:28