Give the Big O notation for the following function. public static void notationF
ID: 3535724 • Letter: G
Question
Give the Big O notation for the following function.
public static void notationFunction(int arr[], int length)
{
System.out.println(“ This function is sweetâ€);
for(int i = 0;i<length;i++)
}
System.out.println(“Arr[“ + i + “] = “ + arr[i]);
}
System.out.println(“Is this function order N?â€);
System.out.println(“maybe...â€);
for (int i = 0;i<100000;i++)
{
System.out.println(“Arr[“ + 0 + “] = †+ arr[0]);
}
for(int i = 0;i<length;i++)
{
for(int j = 0;j<length;j++)
{
System.out.println(“stuffâ€);
}
}
int temp;
for ( int j = 0; j < length; j++ )
for(int y=0; y < length; y++)
{
for ( int k =0; k < length-1-y; k++ )
if(arr[k]>arr[k+1])
{
temp = arr[k+1];
arr[k+1] = arr[k];
arr[k] = temp;
}
}
for(int i = 0;i<length;i++)
{
System.out.println(“Arr[“ + i + “] = “ + arr[i]);
}
}
Explanation / Answer
www.codeproject.com/Articles/37990/Big-O-Algorithm
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.