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
krok68 [10]
4 years ago
15

Consider the following pseudocode. How much time does the code take to execute? Express all answers in terms of the input variab

le n, using Big-Oh O( ) notation.void george(int n) {int m = n;while (m > 1){ for (int i = 1; i < m; i++) int S = 1; m = m/2; }}
Computers and Technology
1 answer:
weeeeeb [17]4 years ago
6 0

Answer:

Time the code takes to execute is O(n²)

Explanation:

The code forms an arithmetic series using it two loops.

n+(n-1)+(n-2)+........+2+1

=n(n+1)/2

=O(n²)

You might be interested in
Write a program that, for four points A, B, C and P, which a) Draws a triangle formed by ABC and a small cross showing the posit
Degger [83]

Answer:

import java.awt.*;

import java.applet.*;

public class DrawTrainlge extends Applet{

static double findDistance(float x1, float y1,float a, float b,float c){

double dis = Math.abs(((a * x1 + b * y1 + c)) /  (Math.sqrt(a * a + b * b)));

return dis;

}

public void paint(Graphics g){

Point[] point = new Point[4];

g.drawLine(point[0].x , point[0].y , point[1].x , point[1].y);

g.drawLine(point[0].x , point[0].y , point[2].x , point[2].y);

g.drawLine(point[2].x , point[2].y , point[1].x , point[1].y);

double newdistance = 9999999;

for(int i=0;i<3;i++){

            int first = (i+1)%3;

            int second = i;

            float a = point[first].y - point[second].y;

            float b = point[second].x - point[first].x;

            float c = a*(point[second].x) + b*(point[second].y);

            double dis = findDistance(point[3].x,point[3].y,a,b,c);

            if(newdistance > dis){

               dis = newdistance;

         }

}

g.drawString("Shortest Distance");

g.drawString(dis);

}

}

Explanation:

  • Inside the findDistance method, find the distance  by using the following formula:

Math.abs(((a * x1 + b * y1 + c)) /  (Math.sqrt(a * a + b * b)))

  • Inside the paint method, give your input in the form of four points(A,B,C,D) .
6 0
3 years ago
If your earning potential is higher than the cost of your higher education,<br> you will have a
igor_vitrenko [27]

Loans take for Higher education does have a positive ROI because you are building skills and work experience that can increase your future earnings.

If your earning potential is higher than the cost of your higher education,

you will have a positive return of investment.

  • The more education is linked with higher lifetime. Based on U.S. Bureau of Labor, college graduates earn an average of 61% more than non-college graduates.

The likelihood of earning more income over the course of a lifetime with a college degree is the main factor in considering if or not to pursue a diploma.

The higher income that is gotten from a college degree is known as the "college wage premium."

Learn more from

brainly.com/question/21069873

7 0
3 years ago
Mia uses the formula pi times r to the power of 2 to find the area of a circle. What is pi times r to the power of 2 an example
erik [133]
A telescope , I think
5 0
3 years ago
Read 2 more answers
When you schedule an appointment, Outlook adds the appointment to the ____ folder by default.
Elis [28]
D is the correct answer! :)
8 0
3 years ago
The Campus Housing Service helps students find apartments. Owners of apartments fill in information forms about the rental units
Alexxx [7]

Answer:

Check the explanation

Explanation:

LI system and software engineering concepts, the use cases are widely used Use case is a collection of eve. or actions steps, it mainly defining the interactions between a system and a role for achieving a specific goal.

Here the actor can he external system or a human being:

For identifying the use case, the below steps needs to he followed

• Identify the actors involved in the system.

  • In our task the actors are the student and the owners  

• Identify the actor's goals

  • Goals are the activities performed

• Identify the use case candidates

The persons who are all actively involved in the use case

• Identify the use case starting points

• Identifying the use case ending points

• rind the scope and the unit of interactions in the use case  

Identifying the steps in Housing system:

• Several implementation steps are provided in the task that needs to he identified in this particular stage

• The housing system is helping the stuck,. for finding the con. apartments which is meeting their requirements

Check the below diagram.

6 0
4 years ago
Other questions:
  • Under what circumstances would it be appropriate to use the sentence method of note taking, and what are the advantages and disa
    7·2 answers
  • Once i have internet connection do i need anything else to surf the web
    6·1 answer
  • how can you repin an image on your Pinterest pin board A. click on the "repin" button B. click on the "add pin" button C. click
    7·2 answers
  • How are procedural and object-oriented programming approaches similar?
    9·1 answer
  • The process of sending ping requests to a series of devices or to the entire range of networked devices is called a:
    9·1 answer
  • When a communication exchange that does not verify the identity of the endpoints of a communication and accepts any properly for
    10·1 answer
  • A set of instructions to increase a programmer’s pay rate by 10 percent is hidden inside an authorized program. It changes and u
    12·1 answer
  • To use the AutoCalculate area, select the range of cells containing the numbers for a calculation you want to verify and then pr
    6·1 answer
  • Write a program that asks the user to enter the size of a triangle (an integer from 1 to 50). Display the triangle by writing li
    15·1 answer
  • HOMEWORK: Bud, Not Buddy I NOTICE... What do you see? chpter 3-4<br><br>​
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!