Question: How could I prove the Big O average complexity analysis for the following code. void permute (int a[], int n) { for (int i =

How could I prove the Big O average complexity analysis for the following code.

void permute (int a[], int n) { for (int i = 0; i < n; i++) { // Guess at a value to put into a[i] int guess = rnd(n); while (find(a, a+i, guess) != a+i) { // If it's one that we've already used, guess again. guess = rnd(n); } a[i] = guess; } }

I have to come up with complex case analysis for this permute alogorithm. Once I have predicted an analysis, then I have to chose values for N and R to find the time complexity and record them on a spreadsheet to find a tread for this analysis. I need help on find and determining the average complexity for this snipppt of the program. Thanks

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!