# Question: convert the following algorithm descriptions into working java methods and...

###### Question details

Convert the following algorithm descriptions into working Java methods and estimate their big-o notation.

Algorithm 1: Fill the array 'a' from a[0] to a[n-1] as follows: To fill a[i], generate random numbers until you get one that is not already in a[0] to a[i-1].

Algorithm 2: Same as algorithm 1, but keep an extra array called the 'used' array. When a random number, 'ran', is first put into the array 'a', set used[ran] = true. Now, when chosing a random number, no longer check ever position in 'a' before the one you are filling, just check the 'used' array.

Algorithm 3: Fill the array such that a[i] = i+1. Then,

for(i = 1; i < n; i++)

swapReferences(a[i], a[random(0,i)]);

*Note: Write your own swapReferences method to switch two given
positions