Question: Hi i need help finding the cost function in the form wn^x + yn + z where w, x, y and z are real numbers
Hi i need help finding the cost function in the form wn^x + yn + z where w, x, y and z are real numbers and n is a variable referring to the size of the function's input and big O notation. thanks
// PARAM: arr is array to be sorted, n is size of array, i should initially = 0 int ssort(int arr[], int n, int i) { int count = 0;
if (i < n - 1) { // Find and swap smallest remaining int next = i + 1; int smallest = i; count = count + 2; //
while (next < n) { if (arr[next] < arr[smallest]) { smallest = next; count = count + 1; } count = count + 1; next++; count = count + 2; } count = count + 1; //
// Swap i with smallest int temp = arr[i]; arr[i] = arr[smallest]; arr[smallest] = temp; count = count + 3; ssort(arr, n, i + 1);
} count = count + 1; // return count; }
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
