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, 23.06.2019 19:00
Whose task it is to ensure that the product flows logically from one step to another?
Answers: 3
question
Computers and Technology, 24.06.2019 04:30
Fall protection, confined space entry procedures, controlled noise levels, and protection from chemical hazards are some of the things that contribute to a safe and
Answers: 1
question
Computers and Technology, 24.06.2019 09:10
  to change the number of rows and columns displayed by the excel object a. select the object and drag a size handle on the active object. b. deselect the object and drag a size handle of the object. c. deselect the object and drag a row or column divider of the object. d. select the object and drag a row or column divider on the active object.
Answers: 2
question
Computers and Technology, 24.06.2019 16:00
How are roger williams, james oglethorpe, and william penn similar?
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
Questions on the website: 13722362