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, 22.06.2019 04:30
Dr. wisteria is a prominent chiropractor in the chicago area. she wants to provide a forum for her patients to discuss their health concerns and to seek and offer advice to other patients. which telecommunications tool is most appropriate for dr. wisteria's needs?
Answers: 3
question
Computers and Technology, 23.06.2019 04:20
Which network media uses different regions of the electromagnetic spectrum to transmit signals through air? uses different regions of the electromagnetic spectrum to transmit signals through air.
Answers: 2
question
Computers and Technology, 23.06.2019 15:20
What does a bonus object do? a. subtracts lives b. keeps track of a player's health c. gives a player an advantage d. makes text appear
Answers: 1
question
Computers and Technology, 23.06.2019 19:30
Anul 2017 tocmai s-a încheiat, suntem trişti deoarece era număr prim, însă avem şi o veste bună, anul 2018 este produs de două numere prime, 2 şi 1009. dorel, un adevărat colecţionar de numere prime, şi-a pus întrebarea: “câte numere dintr-un interval [a,b] se pot scrie ca produs de două numere prime? “.
Answers: 3
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, 07.05.2020 04:08
question
Mathematics, 07.05.2020 04:08
question
Mathematics, 07.05.2020 04:08
question
English, 07.05.2020 04:08
Questions on the website: 13722362