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 00:30
Advantages and disadvantages of binary system
Answers: 1
question
Computers and Technology, 23.06.2019 16:00
Write a grading program for a class with the following grading policies: a. there are two quizzes, each graded on the basis of 10 points. b. there is one midterm exam and one final exam, each graded on the basis of 100 points. c. the final exam counts for 50% of the grade, the midterm counts for 25%, and the two quizzes together count for a total of 25%. (do not forget to normalize the quiz scores. they should be converted to a percentage before they are averaged in.) any grade of 90 or more is an a, any grade of 80 or more (but less than 90) is a b, any grade of 70 or more (but less than 80) is a c, any grade of 60 or more (but less than 70) is a d, and any grade below 60 is an f. the program will read in the student’s scores and output the student’s record, which consists of two quiz and two exam scores as well as the student’s average numeric score for the entire course and final letter grade. define and use a structure for the student reco
Answers: 2
question
Computers and Technology, 24.06.2019 13:30
What process should be followed while giving a reference? sam has given a reference of his previous manager in his resume. sam should him in advance that the potential employers will him.
Answers: 1
question
Computers and Technology, 24.06.2019 16:00
To fill (copy) a cell across or down, point to the of the cell and drag. top left corner top right corner bottom left corner bottom right corner
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, 13.07.2019 15:10
question
History, 13.07.2019 15:10
question
Mathematics, 13.07.2019 15:10