Computers and Technology

Write a recursive, boolean -valued method named search that accepts an integer array , the number of elements in the array , and an integer (in that order), and returns whether the integer is present as an element in the array . Searching for a particular value in an array can be performed in the following recursive manner: If the array has no elements , the value is not there.
Compare the first element of the array to the value , if they're equal , the value is there; other search for the value in the rest of the array .
My program is..
public boolean search(int arr[],int n, int m){
if(n==0){
return false;
}
if(arr[n]==m){
return true;
}
n=n-1;
return search(arr[],n-1,m);
}
but I recieve a compiler error CTest. java:10: error: '.class' expected
what am I doing wrong?

answer
Answers: 3

Other questions on the subject: Computers and Technology

image
Computers and Technology, 22.06.2019 11:00, abelxoconda
Which are examples of note-taking tools? check all that recording devices sticky notes digital highlighters paper flags highlighting pens digital displays digital flags
Answers: 1
image
Computers and Technology, 22.06.2019 19:30, ibrahimuskalel
Avariable definition defines the name of a variable that will be used in a program, as well as
Answers: 3
image
Computers and Technology, 23.06.2019 06:30, Knownothing
When early motion pictures played in movie theaters, they were often accompanied by live organ or piano music. which of the following are the most likely reasons that this happened? (select all that apply). the music was provided to distract audience members from the loud sounds made when filmstrips were changed. the music accompanied the movies because the movies were silent and audiences were used to hearing music during plays in theaters. the music usually was played before, and sometimes after the movie, as an alternative form of entertainment. the music viewers to interpret the dramatic action in the films.
Answers: 2
image
Computers and Technology, 23.06.2019 18:30, bsept1018
Report all segments of identity by descent longer than 20 polymorphisms between pairs of individuals in the following cohort of 15 individuals across 49 polymorphisms: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 numeric input 2 points possible (graded) you have 2 attempts to complete the assignment below. for example if the sequence is "bcd", which occurs in "abcdef" , the starting point would be 2 (b), and the finishing point would be 4(d). individuals 7,10 between positions
Answers: 1
Do you know the correct answer?
Write a recursive, boolean -valued method named search that accepts an integer array , the number of...

Questions in other subjects:

Konu
Mathematics, 20.09.2019 22:40
Konu
Biology, 20.09.2019 22:40
Konu
History, 20.09.2019 22:40
Konu
Mathematics, 20.09.2019 22:40