How do I write this binary sort in java using array?
You have write a method that will use binary search to see if a given element is in the array. Assume that the array is already sorted in ascending order. I don't understand binary searches, but if someone shows me through this method what a binary search does, I would be grateful. Thank you.
public boolean findNum(int[] nums, int theNum)
{
}
binary sort in java
Moderator: Board moderators
binary sort in java
Last edited by ushujerra on Wed Mar 20, 2013 1:44 am, edited 1 time in total.
Re: binary sort in java
Code: Select all
public boolean findNum(int[] nums, int theNum)
{
return Arrays.binarySearch(nums, theNum) >= 0;
}