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
Ksju [112]
3 years ago
15

What is the big-O performance estimate of the following function?

Computers and Technology
2 answers:
larisa [96]3 years ago
8 0

Answer:

The time complexity of the code is O(log₇n).

Explanation:

The i is updated by 7*i.On each iteration i is multiplied by 7.So on finding the time complexity of the code given above it will come out to  be log base 7.

When we divide the input by 2 the time complexity is log base 2.

So on dividing it by 7 we get the time complexity of log base 7.

Digiron [165]3 years ago
4 0

Answer:

Since the loop index variable i is initialized to 0, this function will result in infinite execution for all values of n>=0.

If instead the loop index variable is initialized to 1, Big O performance estimate of the code is O(log n) with logarithm base as 7.

Explanation:

Given function:

int f (n) {

int sum = 0;

for (i = 0; i < n; i = 7 * i)

sum += i;

return sum;

} // end f

The complexity is determined by the for loop. Starting value of the index variable i is 0.  At each iteration the value of the index variable i is multiplied by 7 (i=7*i). But multiplication by 7 still leaves the value of the index variable as 0. So loop condition i<n will fail for all n>=0 and the loop will continue indefinitely since the termination condition will never be achieved.

However if the loop index variable i is initialized to 1 instead, the loop will run O(log n) times with 7 as the base of the logarithm due to successive multiplication of index variable by 7 at each iteration.

You might be interested in
This is your code.
topjm [15]

Answer:

11

Explanation:

the second in the d aray is c because to call the first value, it is d[0]. So, to call c, you put d[2]. And the 0 of the c array, or the 0 of the 2 of the d array, it is 11

put it in a program. I use JS so if you have an Apple, open script editor and change the script from AppleScript to JavaScript and put in this code:

var a = [5, 10, 15];

var b = [2, 4, 6];

var C = [11, 33, 55];

var d = [a, b, C];

d[2][0];

3 0
3 years ago
Create a Card class that represents a playing card. It should have an int instance variable named rank and a char variable named
Helen [10]

Answer:

Explanation:

The following code is written in Java. It creates the Card class and then uses it to create a full house and print out the rank and suit of every card in that hand.

class Card {

   int rank;

   char suit;

   public Card(int rank, char suit) {

       this.rank = rank;

       this.suit = suit;

   }

   public int getRank() {

       return rank;

   }

   public char getSuit() {

       return suit;

   }

}

class CardTester {

   public static void main(String[] args) {

       Card card1 = new Card(3, '♥');

       Card card2 = new Card(3, '♠');

       Card card3 = new Card(3, '♦');

       Card card4 = new Card(2, '♦');

       Card card5 = new Card(2, '♣');

       System.out.println("Card 1: " + card1.getRank() + " of " + card1.getSuit());

       System.out.println("Card 2: " + card2.getRank() + " of " + card2.getSuit());

       System.out.println("Card 3: " + card3.getRank() + " of " + card3.getSuit());

       System.out.println("Card 4: " + card4.getRank() + " of " + card4.getSuit());

       System.out.println("Card 5: " + card5.getRank() + " of " + card5.getSuit());

   }

}

3 0
3 years ago
15. Feelings (maps, coins, clues, etc.) and the invisClue books were some innovative ways used to keep __________ players engage
Anit [1.1K]

Answer:

pong i could be wrong i think its right tho

Explanation:

5 0
3 years ago
Read 2 more answers
consider the following code segment, which appears in a method in a class other than password. the code segment does not compile
Romashka [77]

The code segment does not compile because the method 'reset' does not return a value that can be displayed.

A method refers to a block of that which only runs when it is called. It is permissible to pass data, referred to as parameters, into a method. Methods are used to accomplish certain actions, and they are also called functions. As per the given code segment that appears as a method in a class, it does not compile because the method named 'reset' is not returning a value that can be printed on the screen as an output.

"

<em>Complete question:</em>

Consider the following code segment, which appears in a method in a class other than password.

Password p = new Password("password");

System.out.println("The new password is " + p.reset("password"));

The code segment does not compile because _____________ .

"

You can learn more about Method at

brainly.com/question/27415982

#SPJ4

4 0
1 year ago
Match the following: B. Static libraries A. Dynamic Link Libraries (DLL) - Using static libraries - Making some changes to DLL A
TiliK225 [7]

Answer:  hello your question is poorly written and I have been able to properly arrange them with the correct matching

answer

Static libraries :  C

Dynamic link libraries:  A

Using static libraries:  B

Making some changes to DLL:   D

Explanation:

Matching each term with its meaning

<u>Static Libraries </u> : Are attached to the application at the compile time using the Linker ( C )

<u>Dynamic link libraries</u> ( DLL ) : Is Loaded at runtime as applications need them ( A )

<u>Using static Libraries </u>: Makes your program files larger compared to using DLL ( B )

<u>Making some changes to DLL </u>: Does not require application using them to recompile ( D )

8 0
3 years ago
Other questions:
  • Within the Chart Design tab, which section is used to change the data of a previously created chart?
    12·1 answer
  • Students who respond promptly to e-mails are following which netiquette rule?
    13·2 answers
  • What is the purpose of the domain name​
    5·1 answer
  • What are the four types of technical drawing?​
    9·1 answer
  • What does the Python print() function do?
    7·1 answer
  • Explain the term game! And give me complete sentences. U can use ur opinion as well!
    11·1 answer
  • Give one (1) advantage and one(1) disadvantage of using and integrated software package over a custom written one.
    15·1 answer
  • 8. Ito ay paraan ng pagkuha ng kopya ng isang file mula sa isang website patungo sa file system. * 1 point A. Copyright B. Downl
    8·1 answer
  • Which type of GUI control would be best to use if you wanted the user to select one date from a list of three possible dates to
    5·1 answer
  • Most spyware programs are benign in that they do not perform malicious acts or steal data. group of answer choices true false
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!