subject

What would be the value of list after four passes of the help() method? public void sort( int[] list, int front, int back)
{
int mid = (front+back)/2;
if( mid==front) return;
sort(list, front, mid);
sort(list, mid, back);
help(list, front, back);
}

private void help(int[] list, int front, int back)
{
int[] temp = new int[back-front];
int i = front, j = (front+back)/2, k =0;
int mid =j;
while( i ray[max])
max = j;
}
if( max != i){
int temp = ray[max];
ray[max] = ray[i];
ray[i] = temp;
}
}
}
a
7
b
10
c
11
d
9
e
8

If funSearch( ) will only work on sorted data, what type of sort is funSearch() ?

int funSearch( int[] list, int val )
{
int len=list. length;
int bot=0, top=len-1;
int middle=0;
while(bot<=top)
{
middle=(bot+top)/2;
if (list[middle] == val)
return middle;
else
if(list[middle]>val)
top=middle-1;
else
bot=middle+1;
}
return -1;
}
a
whatASearch
b
linearSearch
c
quickSearch
d
binarySearch
e
selectionSearch

If funSearch() is passed a list that contains 100 integers in sorted order, how many checks will funSearch() have to make before it determines that the item it is searching for is NOT in the list ?

int funSearch( int[] list, int val )
{
int len=list. length;
int bot=0, top=len-1;
int middle=0;
while(bot<=top)
{
middle=(bot+top)/2;
if (list[middle] == val)
return middle;
else
if(list[middle]>val)
top=middle-1;
else
bot=middle+1;
}
return -1;
}
a
7
b
9
c
6
d
5
e
8

Please and thank you.

ansver
Answers: 1

Other questions on the subject: Computers and Technology

image
Computers and Technology, 22.06.2019 08:00, wgdelgado
What is the first step in creating a maintenance ?
Answers: 2
image
Computers and Technology, 22.06.2019 09:00, sophiawatson70
Create a cell reference in a formula by typing in the cell name or         a. right-clicking the cell. b. clicking the cell. c. clicking the column where the cell is located. d. clicking the row where the cell is located.
Answers: 1
image
Computers and Technology, 23.06.2019 19:30, bevanscory123
What are loans to a company or government for a set amount of time
Answers: 1
image
Computers and Technology, 24.06.2019 09:40, anyar
Healthy study habits are best described as
Answers: 1
You know the right answer?
What would be the value of list after four passes of the help() method? public void sort( int[] lis...

Questions in other subjects: