Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

** IN JAVA** I am currently attempting to write a method with the header public int findFirstRow(int[][] matrix) this method will receive a 2D array(matrix)

** IN JAVA**

I am currently attempting to write a method with the header

public int findFirstRow(int[][] matrix)

this method will receive a 2D array(matrix) where all the entries are either 1 or 0

the method will then return the index of the row that contains the greatest number of 1's

I need the pseudo code for this as well as the overall idea of how this is done.

What I have tried so far....

did two nested for loops i and j that traverse the 2d array and when an element [i][j]==0, then oneCounter++;

the problem with this was that the nested for loops would traverse the entire 2d array and oneCounter would return

the total number of 1's in the entire array.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Security

Authors: Alfred Basta, Melissa Zgola

1st Edition

1435453905, 978-1435453906

More Books

Students also viewed these Databases questions

Question

What abilities are possible because humans use symbols?

Answered: 1 week ago