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
Which table option automatically adjusts column widths to fit cell content? autofit contents merge cells autofit window fixed co
noname [10]
Which table option automatically adjusts column widths to fit cell content?
autofit contents
6 0
3 years ago
Vẽ sơ đồ lắp đặt gồm 2 cầu chì, 1 ổ điện, 2 cực điều khiển 2 đèn mắc song song
Nookie1986 [14]

Answer:

okokikhjhghjjjkkkkkokoloo

7 0
2 years ago
Which of the following statements concerning a short in a series circuit is true?
Romashka [77]

Answer:

what is the answers it gave you?

6 0
2 years ago
Distributed computing is a term that describes the work that autonomous computers can do to achieve a common goal, especially in
Bond [772]

Answer:

To find the solution of Global warming, to find the combination of some drugs and test them, etc.

Explanation:

Distributed computing can be described as when a number of computers connected on the network communicate with each other by passing messages, and these systems are known as distributed systems.

There are various goals that can be accomplished using distributed computing, one of them is to find the solution of Global warming, by coordinating with different areas.  

Another one is to find the combination of some drugs and test them to make new medicine.

7 0
2 years ago
Between which zones and a DMZ should firewalls be placed? Choose two answers.
brilliants [131]

Answer:

Internal and External Zones

Explanation:

Demilitarized Zone (DMZ) in a network means that, we make sure the security of network at higher level as military make sure the security of their bases or zones.

In this type of network, The network of the internal organization (LAN) needs security from hackers and unauthorized users who are trying to access the resources and information from the network.

This network is divided into two major zones. A DMZ has been placed between two zones along with firewalls enhance the security of LAN Network from the networks on internet. These two zones are named as Internal and External Zone. The firewall between DMZ and External zones monitors the users from external networks on the internet who tries to access organization's network. Internal network monitors the traffic between DMZ and Internal LAN network.

4 0
3 years ago
Other questions:
  • Explain why the game of economics has no winner
    8·1 answer
  • Data hiding, which means that critical data stored inside the object is protected from code outside the object, is accomplished
    14·2 answers
  • Technician A says that the engine block is the solid frame from which all automotive and truck engines are constructed and is ma
    10·2 answers
  • The darker shadow of an eclipse is called the penumbra.<br><br> True<br><br> False
    12·1 answer
  • Write a program that does the following:
    11·1 answer
  • As you type your outline, click Demote to move a line of text
    13·2 answers
  • When was kale discovered?
    9·1 answer
  • The overall cost of wiring in addressable fire alarm system is significantly cheaper than the conventional one. Why is it so?
    14·1 answer
  • Complete the function favoriteFlower(). Note that the program will not run as is because the function is incomplete. The purpose
    15·1 answer
  • You are a software engineer at a company where management routinely encourages you and your colleagues to use pirated software.
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!