Shuffle an array [2 approaches]

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 Algorithm

Let 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...

 •  0 comments  •  flag
Share on Twitter
Published on August 23, 2021 06:28
No comments have been added yet.