0
Can anyone will be able to provide me a program of binary search of arrays in Java ? Please help somebody. 🙏🙏
What is the mistake here? Why is the program not running? Please look into it. https://code.sololearn.com/ca5MgRZj25M0/?ref=app
11 Answers
0
So kindly please correct it tomorrow is my exam that's why I need it urgent. And please reply as soon as possible.
+ 2
You can see the mistakes in compiler messages and make it better.
+ 1
Ya, But I'm not to able to figure out what should I do, actually I'm a beginner 😔😔
+ 1
🙃🙃🙃
+ 1
So you may not understand how to correct the code, even if I say.. Otherwise I may try.
Read the links then try your own code.
0
Without attempting step 1, attempting step 10 ?
Anybody need to complete the basics first..
Your array declaration is wrong.
And Mainly :
In java, execution starts from main method. You don't have main method to start run the code!!! So it won't run.
0
That's not correct way to bother in the last minute. It may take some days to understand.
Anyways , hope this simplifies:
Array declaration correct way is :
int arr[] = new int [ <size> ];
And about binary seach :
https://www.sololearn.com/learn/664/?ref=app
https://www.sololearn.com/learn/764/?ref=app
Call your binary seach method in main method by adding :
public static void main(String a[]) {
Search( < number > ); // ex: search(5);
}
0
Thanks a lot
0
Is that your own code?
0
Yeah
0
Copied from my friend