1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Olenka [21]
3 years ago
12

(Shuffle rows) Write a method that shuffles the rows in a two-dimensional int array using the following header: public static vo

id shuffle(int[][] m)
Computers and Technology
1 answer:
Lostsunrise [7]3 years ago
7 0

The question is incomplete. The complete question is :

Write a method that shuffles the rows in a two-dimensional int array using the following header: public static void shuffle(int[][] m)

Write a test program that shuffles the following matrix: int[][] m = {{1, 2}, {3, 4}, {5, 6}, {7, 8}, {9, 10}};

Solution :

//filename_suffle.java

#public class shuffle{

public_static_void_main_(String[] args) {

int[][] m = {{1, 2} {3, 4} {5, 6} {7, 8} {9, 10}};

System.out.println("Before shuffle");

displayMatrix(m);

System(dot)out(dot)println("After shuffle");

shuffle(m);

displayMatrix(m);

}

public_static_void_displayMatrix_(int[][] m) {

for (int i = 0; i < m.length; i++) {

for (int j = 0; j < m[i].length; j++) {

System.out.print(m[i][j] + " ");

}

System(dot)out(dot)println("");

}

}

public_static_void_shuffle_(int[][] m) {

int r1; // random row index

for (int i = 0; i < m.length; i++) {

for (int j = 0; j < m[i].length; j++) {

do {

r1 = (int)(Math.random() * m.length);

} while (r1 == i);

int[] temp = m[i];

m[i] = m[r1];

m[r1] = temp;

}

}

}

}

You might be interested in
The following algorithm adds all the entries in a square n × n array A. Analyze this algorithm where the work unit is the additi
wlad13 [49]

Answer:

T(n)=n(n+1)/2

Explanation:

See the attached picture for detailed explanation.

6 0
4 years ago
How do you construct a JK Flip-flop from a T Flip-flop?
Ainat [17]
<span>Its very simple. All you have to do is short J and K inputs i.e. same inputs go into both J and K.
</span><span>Actually T flip flop is the special case of J-K flip flop when both the inputs of J-K flip flop are equal to 1 ( or logic high) j=k=1. Know electronics has well explained about its designing. A very good use of this flip flop or J=K=1 condition is in counters.

</span><span>The J-K flip flop is universal and can be used to make any of the other times. I agree with know electronics and VKP that it can be used in counters. Adding the practical use of conversion here . When you are working on ASIC or SOC Design, In the ECO stage if you want T or D flipflop and you have only JK flipflops then this conversion techniques can be helpful. similarly MUX conversions are helpful in realizing computational gates</span>

5 0
3 years ago
The term ________ refers to the enormous amount of information that firms now have access to but cannot handle using conventiona
Sedaia [141]

The term data dump refers to the enormous amount of information that firms now have access to but cannot handle using conventional data management and data mining software. information overload big data churn data mining data dump

4 0
3 years ago
6. The
nordsb [41]

In spermatocytogenesis, a diploid spermatogonium, which resides in the basal compartment of the seminiferous tubules, divides mitotically, producing two diploid intermediate cells called primary spermatocytes.

Fertilization takes place in the fallopian tubes, which connect the ovaries to the uterus. Fertilization happens when a sperm cell successfully meets an egg cell in the fallopian tube.

7 0
4 years ago
Software that interprets commands from the keyboard and mouse is also known as the ​
Luda [366]

Answer:

THE OPERATING SYSTEM (OS)

Explanation:

6 0
4 years ago
Other questions:
  • Write a c++ application that computes gross salary for Mr.A,given that during the interview session and before started work, it
    5·1 answer
  • ____________ occurs when a provider does not support data export or when a provider's service is unavailable through others.
    11·1 answer
  • Your long and short term goals (career or job etc)? ANSWER FAST!!!
    6·1 answer
  • Which kind of testing runs the system in a simulated environment using simulated data?a) validation testing. b) verification tes
    5·1 answer
  • Which Windows 7 feature allows a user to open multiple programs at the same time?
    7·1 answer
  • What is “public domain” and how is it used?
    7·1 answer
  • What is the output of the following program?
    11·2 answers
  • The encapsulating security ______ protocol provides secrecy for the contents of network communications as well as system-to-syst
    14·1 answer
  • Why it is not recommended to add sound effect on slide transition? Write at least two reasons.​
    6·1 answer
  • What is known as the global network of computers?
    9·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!