I don't get what you mean
Type: Posts; User: nicsa
I don't get what you mean
public int sortedSearch(int value)
{
int x=0;
while(x<a.length)
{
if(a[x]==value)
{
return x;
}
else
public int sortedSearch(int value)
{
for(int x=0;x<a.length; x++)
{
if(a[x]==value)
return x;
}
return -1;
}
I am trying to create a method to search a sorted array for a value in the most efficient way possible. My teacher doesn't want us to use binary search yet. This is the code I have so far, is there...