Question: Consider the pseudocode for procedure count Earthworms(E,n), given below. The input to the procedure is 2-dimensional array E and scalar n. Each element E[JU] (the
Consider the pseudocode for procedure count Earthworms(E,n), given below. The input to the procedure is 2-dimensional array E and scalar n. Each element E[JU] (the element in row i, and column j of array E) is a binary variable representing whether or not there is an earthworm at the coordinates given by that element of the matrix. n gives the number of rows and columns of E (it is an n n square array. the same length in both dimensions). Give an estimate of the complexity of this procedure, where complexity is measured by the number of additions needed. procedure count Earthworms (E,n): count 0 for i from 1 to n: for j from 1 to n: count-count+E[ij] return count Select one
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
