Question: A 2 - D array A [ 0 . . n - 1 ] [ 0 . . n - 1 ] represents a binary

A 2-D array A[0..n-1][0..n-1] represents a binary image of n by n pixels. An element of A is either 0 representing a black pixel or 1 representing a white pixel. The following algorithm receives the image A and produces another binary image B of the same size.
ALGORITHM Enigma (A, B, n){
for (int i =0; i < n; i++)
for (int j =0; j < n; j++)
}
1.2.3.
B[i][j]=(A[j][i]+1)%2;
What does this algorithm do?
Find the number of arithmetic operations T(n) done for a given n. What is the Big-O complexity of the algorithm in terms of n.
ALGORITHM Fun (a[], int s, int e){
int m=s;
for j =s+1toe
if (a[j]

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 Programming Questions!