subject

Banish. write a method named banishthat accepts two arrays of integers a1 and a2 as parameters and removes all occurrences of a2's values from a1.

an element is "removed" by shifting all subsequent elements one index to the left to cover it up, placing a 0 into the last index.

the original relative ordering of a1's elements should be retained. for example, suppose the following two arrays are declared and the following call is made:

int[] a1 = {42, 3, 9, 42, 42, 11, 42, 9, 42, 42, 17, 0, 8, , 4, 9, 0, 1}; int[] a2 = {42, , 9}; banish(a1, a2);

after the call has finished, the contents of a1 should become: [3, 11, 17, 0, 8, 4, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]

notice that all occurrences of the values 42, , and 9 have been removed and replaced by 0s at the end of the array, and the remaining values have shifted left to compensate.

ansver
Answers: 1

Another question on Computers and Technology

question
Computers and Technology, 21.06.2019 22:10
Is the following an example of social media viral marketing? indicate your response by selecting yes or no. when you sign onto your favorite social networking website, you get messages from friends who have seen a television show they thought was a "must see! "
Answers: 1
question
Computers and Technology, 23.06.2019 00:00
Which is the correct sequence of steps to set up a document in landscape orientation? a. select page setup from the file menu. then click the margins tab and select landscape. b. select page setup from the edit menu. then click the margins tab and select landscape. c. select page setup from the insert menu. then click the margins tab and select landscape. d. select page setup from the format menu. then click the margins tab and select landscape
Answers: 1
question
Computers and Technology, 23.06.2019 15:00
Barbara is interested in pursuing a career in the science and math pathway. which qualifications will her reach that goal? a.an advanced knowledge of physics and math b.an advanced knowledge of engineering and math c. an advanced knowledge of physics and robotics an d. advanced knowledge of machinery and math
Answers: 1
question
Computers and Technology, 23.06.2019 23:40
Which of the following calculates the total from the adjacent cell through the first nonnumeric cell by default, using the sum function in its formula? -average -autosum -counta -max
Answers: 1
You know the right answer?
Banish. write a method named banishthat accepts two arrays of integers a1 and a2 as parameters and r...
Questions
question
Mathematics, 05.09.2019 23:30
question
Physics, 05.09.2019 23:30
question
Mathematics, 05.09.2019 23:30
Questions on the website: 13722361