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
Bogdan [553]
4 years ago
8

Given the following Python function, find out an asymptotically tight bound of the algorithm in term of n (the input parameter).

This function returns a list of n integers. Each element in the list contains the value f(i) = i + ⌊ i 2 ⁄ ⌋ + ⌊ i 4 ⁄ ⌋ + ⋯ 1. Write your answer as Python comments in the file csc220a2.py
Computers and Technology
1 answer:
alexandr1967 [171]4 years ago
6 0

Answer:

Explanation:

There are two loops in the given code snippet:

1. Both the loops are nested

2. The outer loop which is for loop is running n number of times linearly.

3. The inner loop which is while loop is jumping in the power of 2, which makes it run log n number of times.

So the overall complexity of the code will be= n * log n

Time complexity(or upper bound)= O(n log n).

Hit the thumbs up if you liked the answer. :)

You might be interested in
Which two hardware features would a technician monitor within the bios if a computer was suspected of overheating?
Firdavs [7]
I would say probably the CPU Fan and the CPU clock speed 
4 0
3 years ago
In which situation would you typically use a stand-alone certificate authority (CA) in your public key infrastructure (PKI) desi
denpristay [2]
The animals have no place way to get go to sleep
5 0
3 years ago
A ____ resembles a circle of computers that communicate with each other.
Sidana [21]

Answer:

ring network

Explanation:

In a ring network, the nodes are arranged in a circular pattern where each node is connected to two adjacent nodes. In this topology, any node can communicate with any other node via the intermediaries.

In comparison,

- in a star network every communication needs to pass through a central hub node

- in a bus, each node is connected to a shared linear communication bus.

- in a hierarchical network nodes are organized along a tree structure layout.

4 0
4 years ago
Select the correct text in the passage.
Tpy6a [65]

Answer:

A B D

Explanation:

4 0
3 years ago
What is the output of the sum of 1001011 and 100011 displayed in hexadecimal?
N76 [4]

Answer:

1001011_2    +   100011_2   =    6E_{hex}

Explanation:

Required

1001011_2 + 100011_2 = []_{16}

First, carry out the addition in binary

1001011_2    +   100011_2   =    1101110_2

The step is as follows (start adding from right to left):

1 + 1 = 10 --- Write 0 carry 1

1 + 1 + 1(carry) = 11 ---- Write 1 carry 1

0 + 0 + 1(carry) = 1 ---- Write 1

1 + 0 = 1 --- Write 1

0 + 0 = 0 ---- Write 0

0 + 0 = 0 ---- Write 0

1 + 1 = 10 --- Write 0 carry 1

No other number to add ; So, write 1 (the last carry)

So, we have:

1001011_2    +   100011_2   =    1101110_2

Next, convert 1101110_2 to base 10 using product rule

1101110_2 = 1 * 2^6 +1 * 2^5 + 0 * 2^4 + 1 * 2^3 + 1 * 2^2 + 1 * 2^1 + 0 * 2^0

1101110_2 = 64 +32 + 0 + 8 + 4 + 2 + 0

1101110_2 = 110_{10}

Lastly, convert 110_{10} to hexadecimal using division and remainder rule

110/16 \to 6\ R\ 14

6/16 \to 0\ R\ 6

Write the remainder from bottom to top;

110_{10} = 6(14)_{hex}

In hexadecimal

14 \to E

So, we have:

110_{10} = 6E_{hex}

Hence:

1001011_2    +   100011_2   =    6E_{hex}

3 0
3 years ago
Other questions:
  • Cable television systems originated with the invention of a particular component. What was this component called?​
    9·1 answer
  • Your company is experiencing an increase in malware incidents. Your manager is asking for advice on how best to verify that comp
    7·1 answer
  • How much does a Canon PowerShot G7X cost in America?
    14·1 answer
  • When should an individual consider entering parenthood?
    5·1 answer
  • How many bits are required to write decimal number?
    9·1 answer
  • Create a program asks a user for an odd positive integer. If the user gives and even number or a number that is negative it prom
    7·1 answer
  • An administrator needs to set up an authentication server for users connecting to a network through a VPN. What kind of server c
    12·1 answer
  • Given that add, a function that expects two integer parameters and returns their sum, and given that two variables, euro_sales a
    7·1 answer
  • What type of data would a RDBMS store in a linked list, two-way linked list, or B-trees? What are the advantages and disadvantag
    5·1 answer
  • Type the correct answer in the box. Spell all words correctly. Which language should you use to add functionality to web pages?
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!