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
vagabundo [1.1K]
3 years ago
14

What is the space complexity of the algorithm?ArithmeticSeries(list, listSize) { i = 0 arithmeticSum = 0 while (i < listSize)

{ arithmeticSum = arithmeticSum + list[i] i = i + 1 } return arithmeticSum}
Computers and Technology
1 answer:
blondinia [14]3 years ago
7 0

Answer:

O(n) which is a linear space complexity

Explanation:

Space complexity is the amount of memory space needed for a program code to be executed and return results. Space complexity depends on the input space and the auxiliary space used by the algorithm.

The list or array is an integer array of 'n' items, with the memory size 4*n, which is the memory size of an integer multiplied by the number of items in the list. The listSize,  i, and arithmeticSum are all integers, the memory space is 4(3) = 12. The return statement passes the content of the arithmetic variable to another variable of space 4.

The total space complexity of the algorithm is "4n + 16" which is a linear space complexity.

You might be interested in
Which of the following would you not see on a windows 10 start menu?
mixas84 [53]
Task view is the option that you would not see on a Windows 10 Start menu, whereas if you click the Windows button, you can see tiles with different applications, all of your apps in the form of tiles you can distribute according to your own taste, and power button where you can choose whether you want to shut down your computer, put it to sleep, or log out.
4 0
3 years ago
The Internet may best be compared to a/an
Usimov [2.4K]
A volcano because its always erupting
3 0
3 years ago
9.10: Reverse ArrayWrite a function that accepts an int array and the array ’s size as arguments . The function should create a
AleksandrR [38]

Answer:

#include <iostream>

using namespace std;

int * reverse(int a[],int n)//function to reverse the array.

{

   int i;

   for(i=0;i<n/2;i++)

   {

       int temp=a[i];

       a[i]=a[n-i-1];

       a[n-i-1]=temp;

   }

   return a;//return pointer to the array.

}

int main() {

   int array[50],* arr,N;//declaring three variables.

   cin>>N;//taking input of size..

   if(N>50||N<0)//if size greater than 50 or less than 0 then terminating the program..

   return 0;

   for(int i=0;i<N;i++)

   {

       cin>>array[i];//prompting array elements..

   }

   arr=reverse(array,N);//function call.

   for(int i=0;i<N;i++)

   cout<<arr[i]<<endl;//printing reversed array..

   cout<<endl;

return 0;

}

Output:-

5

4 5 6 7 8

8

7

6

5

4

Explanation:

I have created a function reverse which reverses the array and returns pointer to an array.I have also considered edge cases where the function terminates if the value of the N(size) is greater than 50 or less than 0.

8 0
3 years ago
The Online Shopping system facilitates the customer to view the products, inquire about the product details, and product availab
jeyben [28]

Answer:

see explaination

Explanation:

We will consider the five Actors in the prearranged Online shopping software system:

Customer:

The scheme allows the customer to do below mention actions:

View goods and inquire about the niceties of products and their ease of use.

To create version to be able to purchase invention from the structure.

Browse crop through search category or shortest search alternative.

Place order for the necessary crop.

Make sum for the order(s) positioned.

Payment System:

Payment system allows client to pay using subsequent two methods:

Credit card.

PayPal.

Seller:

System allow seller to perform underneath actions:

Place the foodstuffs for selling under apposite product category.

Create account to happen to a member.

Administrator:

Following actions are perform by Admin:

Manage the goods posted in the system.

Modify existing manufactured goods categories or add novel categories for foodstuffs.

Site Manager:

System privileges Site director with the following role in the system:

View information on:

Orders Placed by customer

Products added by seller

Accounts created by users

check attachment

3 0
3 years ago
ACL 1 has three statements, in the following order, with address and wildcard mask values as follows: 1.0.0.0 0.255.255.255, 1.1
larisa86 [58]

If a router tried to match a packet sourced from IP address 1.1.1.1 using this ACL, the first statement will be used.

a. First

<u>Explanation:</u>

We use ACL technology to make basic security level in the network.  ACL is strictly used to update the routing in the network and make sure network pears and make sure the flow control for network traffic is followed.

Since it is routing ip address through ACL statement. It all depends on how the network engineer routed the traffic in the network. A packet with source IP address 1.1.1.1 would match any of the three explicitly configured commands described in the question. As a result, the first statement will be used.

The router searches the ACL statement by order and when the match is found it stops execution of the ACL statement that will match with the first occurrence.

7 0
3 years ago
Other questions:
  • For an external usb hard drive attached to a computer, which is more suitable: a writethrough cache or a block cache
    14·2 answers
  • Compose a program to examine the string "Hello, world!\n", and calculate the total decimal numeric value of all the characters i
    7·1 answer
  • The _____ dialog box lets you specify which files are to be merged.
    14·1 answer
  • Clicking the ____ opens the insert function dialog box.
    13·1 answer
  • What term is used to describe the discovery, collection, and analysis of evidence found on computers and networks?
    5·1 answer
  • A file name extension provides what information about a file?
    6·1 answer
  • In dynamic programming, the technique of storing the previously calculated values is called A. Saving value property B. Storing
    7·1 answer
  • Which of the following is NOT a factor of identifying graphic design?
    10·2 answers
  • How to make a message appear in more than one slack channel
    9·1 answer
  • Which of the following statements about recommendation engines is TRUE?A: An online recommendation engine is a set of algorithms
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!