Ask Question, Ask an Expert

+61-413 786 465

info@mywordsolution.com

Ask Computer Engineering Expert

Since memory is becoming more & cheaper, the prominence of runtime complexity is enhancing. However, it is very much significant to analyses the amount of memory utilized by a program. If the running time of any algorithms is not good then this will take longer to execute. However, if this takes more memory (the space complexity is more) beyond the capacity of the machine then the program will not execute at all. Therefore it is more critical than run time complexity. However, the matter of respite is that memory is reutilized throughout the course of program execution.

We will analyses this for recursive & iterative programs.

For an iterative program, usually this is just a matter of looking at the variable declarations and storage allocation calls, for example number of variables, length of an array etc.

The analysis of recursive program w.r.t. space complexity is more complexes as the space utilized at any time is the total space used through all recursive calls active at that time.

Each of recursive call takes a constant amount of space & some space for local variables and function arguments, and for remembering also some space is allocated where each call must return to. General recursive calls employ linear space. That is, for n recursive calls, the space complexity is O(n).

Assume the following example: Binary Recursion (A binary-recursive routine (potentially) calls itself twice).

A.    If n equals 0 or 1, then return 1

B.     calculate recursively f (n-1)

C.     calculate recursively f (n-2)

D.    Return the total of the results from steps 2 and 3.

Computer Engineering, Engineering

  • Category:- Computer Engineering
  • Reference No.:- M9617514

Have any Question?


Related Questions in Computer Engineering

Select an appropriate data structure for each problem below

Select an appropriate data structure for each problem below. For each, write the name of the type of each data structure (queue, for example). Declare the structure using C code, and draw a picture of the structure. dict ...

Suppose that you have a singly-linked list l containing the

Suppose that you have a singly-linked list L containing the sequence of numbers (1,2,3,4,5,6,7,8,9). Suppose further that you have an initially empty stack S. i) Give a pseudo-code description of a method that uses only ...

Question suppose that you receive an email from someone

Question : Suppose that you receive an email from someone claiming to be Alice, and the email included a digital certificate that contains M = ("Alice", Alice's public key) and [h(M)]_CA, where CA is a certificate author ...

Question skyeducation will develop a new branch in the city

Question : SkyEducation will develop a new branch in the city for J2EE programming training. The information is given in the following table. (Ignore the crashing parameters.) Task a b c d e f g Predecessors - - - a b c ...

My kids love playing uno and we just finished up an intense

My kids love playing UNO and we just finished up an intense round. Lets say that the deck has 80 cards. 20 red, 20 blue, 20 green and 20 yellow.  What is the probability of pulling 3 green cards if the first 2 are replac ...

For this assignment you will produce a reflection paper

For this assignment, you will produce a reflection paper based on your experience in the BSIT program, and in preparation for developing a professional portfolio starting next week. The purpose of the reflection paper is ...

For each of the following situations indicate the

For each of the following situations indicate the appropriate distribution to model the random variable, X. 1. Five cards are selected randomly, with replacement from a deck of 52 cards. Let X= the number of kings select ...

Suppose you are writing software for a radio station that

Suppose you are writing software for a radio station that manages its playlists. The program will generate candidate playlists from a record library automatically and station personnel can then check and modifythem. Disc ...

Suppose our task is to distinguish between humans and

Suppose our task is to distinguish between humans and non-human objects in an image, which classifier would you choose and why? Decision trees, perceptrons or neural nets.

Question suppose that you have called a function called

Question : Suppose that you have called a function called sphere that creates (stores points and normals in a vertex Array and in the buffer) a sphere of radius 1 centered at the origin. Write the portions of the render ...

  • 4,153,160 Questions Asked
  • 13,132 Experts
  • 2,558,936 Questions Answered

Ask Experts for help!!

Looking for Assignment Help?

Start excelling in your Courses, Get help with Assignment

Write us your full requirement for evaluation and you will receive response within 20 minutes turnaround time.

Ask Now Help with Problems, Get a Best Answer

Why might a bank avoid the use of interest rate swaps even

Why might a bank avoid the use of interest rate swaps, even when the institution is exposed to significant interest rate

Describe the difference between zero coupon bonds and

Describe the difference between zero coupon bonds and coupon bonds. Under what conditions will a coupon bond sell at a p

Compute the present value of an annuity of 880 per year

Compute the present value of an annuity of $ 880 per year for 16 years, given a discount rate of 6 percent per annum. As

Compute the present value of an 1150 payment made in ten

Compute the present value of an $1,150 payment made in ten years when the discount rate is 12 percent. (Do not round int

Compute the present value of an annuity of 699 per year

Compute the present value of an annuity of $ 699 per year for 19 years, given a discount rate of 6 percent per annum. As