subject

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?

ansver
Answers: 3

Another question on Computers and Technology

question
Computers and Technology, 24.06.2019 07:30
John recently worked on a project about various programming languages. he learned that though procedural language programs are useful, they have disadvantages too. what is a disadvantage of programs written in procedural languages? a. programs do not represent data complexity. b. programs take more time to execute. c. programs are prone to security threats. d. programs do not interface with multiple platforms.
Answers: 3
question
Computers and Technology, 24.06.2019 15:30
What is the total number of time zones that can be configured to show by default in a calendar in outlook 2016?
Answers: 1
question
Computers and Technology, 24.06.2019 16:00
Which type of cloud computing offers easily accessible software and applications on the machines
Answers: 1
question
Computers and Technology, 24.06.2019 17:40
When analyzing data sets, such as data for human heights or for human weights, a common step is to adjust the data. this can be done by normalizing to values between 0 and 1, or throwing away outliers. for this program, adjust the values by subtracting the smallest value from all the values. the input begins with an integer indicating the number of integers that follow. ex: if the input is 5 30 50 10 70 65, the output is: 20 40 0 60 55
Answers: 1
You know the right answer?
Write a recursive, boolean -valued method named search that accepts an integer array , the number of...
Questions
Questions on the website: 13722363