1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Leviafan [203]
2 years ago
5

Recall the binary search algorithm.1. Using the algorithm/algorithmic environment, give pseudocode using a for loop.AnswerMy alg

orithm for binary search using a for loop is given in Algorithm 1.Algorithm 1BinarySearchFor(A)[[XXX TODO:pseudocode here]]2. Using the algorithm/algorithmic environment, give pseudocode using a while loop.Answer[[XXX TODO:your answer here]]3. Using the algorithm/algorithmic environment, give pseudocode using recursion.Answer[[XXX TODO:your answer here]]4. What is the loop invariant of your second algorithm
Computers and Technology
1 answer:
faust18 [17]2 years ago
5 0

Answer:

Following are the Pseudo Code to the given question:

Explanation:

Following are the pseudo-code by using the For loop:

Defines the A function (node, element)

The node is larger than 0.

if another value of the node equals its element

Loop Break

That element if node. value becomes lower than that

Node is node equivalent.

right

Using other nodes is node equivalent.

 left

Node Return

If the node is vacant

print the Tree is empty

Following are the pseudo-code by using the while loop:

Defines the function A(node,element)

While this node is not zero.

if the value of the node equals the element

Loop Break

The element if node. value is lower than

Node is node equivalent.

right

Using other nodes is equivalent to an a.left node

Node Return

If the node is vacant

print Tree is empty

following are the Pseudo-code for recursion:

Set the function A (node, key)

If no root is the same as the root or no root.

return the root.

If the root value is lower than that of the quest for key return (root. right, key)

Return your lookup (root.left,key)

 

You might be interested in
4
Nataly_w [17]

Answer:

5 hours 25 minutes

Explanation:

It takes 25 minutes to finish a hole

It takes 25*13 minutes to finish 13 holes

325 minutes is require to finish 13 holes

Convert 325 minutes to hours and minutes by dividing it by 60

=5 5/12 hours

Convert 5/12 hours to minutes by multiplying by 60

=25 minutes

The answer is 5 hours 25 minutes

5 0
3 years ago
Write the following program in C++ to print:
Alenkinab [10]
1.
#include <iostream>#include <string>
using namespace std;
int main(){    string chars; // This is where we will put our @ signs and print them    for(int x=0;x < 5; x++){
        chars = chars + '@'; // This will concatenate an @ sign at the end of the variable        cout << chars << "\n";    }}

2.
#include <iostream>#include <string>
using namespace std;
int main(){    string name; // Our variable to store the name    cout << "What is your name? \n"; // Asks the user for their name    cin >> name;    cout << "\nWell, hello " << name << "!";}

3.
#include <iostream>#include <string>
using namespace std;
int main(){    int number; // Our variable    cout << "Enter a number\n"; // Asks for a number    cin >> number;    cout << "You entered " << number << "%!";}

4.
#include <iostream>#include <string>
using namespace std;
int main(){    int number; // Our variable    cout << "Enter a number\n";    cin >> number;
    int check = number % 2; // The modulo operator (the percent sign) gets the remainder of the quotient    if (check == 0) {        cout << number << " is even!"; // If the remainder is 0 then it prints out "x is even"    } else {        cout << number << " is odd!"; // If the remainder is not 0 then it prints out "x is odd"    }}

5.
#include <iostream>#include <string>
using namespace std;
int main(){    float r; // Our variable    cout << "Enter a radius\n";    cin >> r;    if (r < 0){        cout << "Lol. No."; // If the radius is less than zero print out that message    }    float circumference=2*3.14*r;    float area=r*r*3.14;    cout << "\n\n Circumference of circle: " << circumference;    cout << "\n Area of circle: " << area;}
4 0
3 years ago
Is it safe to turn on a computer without ram?
swat32
Well, it is safe to turn a computer on without a RAM, but you can't really do it. RAM is one of the essential components in computers without which you can't really use a computer. You can turn it on, however, nothing will appear on your screen and the system won't boot. So, technically, it is safe, but it won't do anything to your computer as it cannot run without RAM.
4 0
3 years ago
Read 2 more answers
Aniyah is setting up a group of computers in her office that will share several devices. Which type of operating system should s
jenyasd209 [6]

Answer:

B

Explanation:

the software needs to share thus should be networked

8 0
2 years ago
10^4+10-2=<br>10^4+10-2=
yaroslaw [1]
10008 is the answer to your question
4 0
3 years ago
Read 2 more answers
Other questions:
  • Under which menu option of a word processing program does a star appear
    8·1 answer
  • Write a program with a function that accepts a string as an argument and returns a copy of the string with the first character o
    11·1 answer
  • What Will Social Media Look Like in the Future?
    6·1 answer
  • True or False? In a C++ floating-point constant, a decimal point is not required if exponential (E) notation is used
    13·1 answer
  • The goal expressed in this definition states that data visualization is about ________________ .
    11·2 answers
  • Write a test program that prompts the user to enter three sides of the triangle (make sure they define an actual triangle), a co
    5·1 answer
  • An important communication principle states ""prepare before you communicate."" How should this preparation manifest itself in t
    10·1 answer
  • Which command could you use to change to the /usr directory using a relative pathname?
    8·1 answer
  • What type of platform is SAP?
    9·1 answer
  • Type the correct answer in the box. Spell all words correctly.
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!