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

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 07:50
In this lab, you complete a prewritten c++ program for a carpenter who creates personalized house signs. the program is supposed to compute the price of any sign a customer orders, based on the following facts: the charge for all signs is a minimum of $35.00. the first five letters or numbers are included in the minimum charge; there is a $4 charge for each additional character. if the sign is made of oak, add $20.00. no charge is added for pine. black or white characters are included in the minimum charge; there is an additional $15 charge for gold-leaf lettering. instructions ensure the file named housesign.cppis open in the code editor. you need to declare variables for the following, and initialize them where specified: a variable for the cost of the sign initialized to 0.00 (charge). a variable for the number of characters initialized to 8 (numchars). a variable for the color of the characters initialized to "gold" (color). a variable for the wood type initialized to "oak" (woodtype). write the rest of the program using assignment statements and ifstatements as appropriate. the output statements are written for you. execute the program by clicking the run button. your output should be: the charge for this sign is $82. this is the code, // housesign.cpp - this program calculates prices for custom made signs. #include #include using namespace std; int main() { // this is the work done in the housekeeping() function // declare and initialize variables here // charge for this sign // color of characters in sign // number of characters in sign // type of wood // this is the work done in the detailloop() function // write assignment and if statements here // this is the work done in the endofjob() function // output charge for this sign cout < < "the charge for this sign is $" < < charge < < endl; return(0); }
Answers: 1
question
Computers and Technology, 22.06.2019 19:40
Solve the following javafx application: write a javafx application that analyzes a word. the user would type the word in a text field, and the application provides three buttons for the following: - one button, when clicked, displays the length of the word.- another button, when clicked, displays the number of vowels in the word.- another button, when clicked, displays the number of uppercase letters in the word(use the gridpane or hbox and vbox to organize the gui controls).
Answers: 1
question
Computers and Technology, 23.06.2019 00:40
Consider the following statements: struct nametype{string first; string last; }; struct coursetype{string name; int callnum; int credits; char grade; }; struct studenttype{nametype name; double gpa; coursetype course; }; studenttype student; studenttype classlist[100]; coursetype course; nametype name; mark the following statements as valid or invalid. if a statement is invalid, explain why.a.) student.course.callnum = "csc230"; b.) cin > > student.name; c.) classlist[0] = name; d.) classlist[1].gpa = 3.45; e.) name = classlist[15].name; f.) student.name = name; g.) cout < < classlist[10] < < endl; h.) for (int j = 0; j < 100; j++)classlist[j].name = name; i.) classlist.course.credits = 3; j.) course = studenttype.course;
Answers: 1
question
Computers and Technology, 23.06.2019 16:00
Does read theory have answers keys ?
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
question
English, 27.05.2020 00:00
Questions on the website: 13722363