The space complexity of an algorithm is the amount of memory it requires to run to completion.

the space needed by a program contains the following components:

1)  Instruction space:

-stores the executable version of programs and is generally fixed.

2) Data space:

It contains:

a)  Space required by constants and simple variables.Its space is fixed.

b)  Space needed by fixed size stucture variables such as array and structures.

c)  dynamically allocated space.This space is usually variable.

3) enviorntal stack:

-Needed to stores information required to reinvoke suspended processes or functions.

the following data is saved on the stack

- return address.

-value of all local variables

-value of all formal parameters in the function..


The time complexity of an algorithm is the amount of time it needs to run to completion. namely space

To measure the time complexity we can count all operations performed in an algorithm and if we know the time taken for each operation then we can easily compute the total time taken by the algorithm.This time varies from system to system.

Our intention is to estimate execution time of an algorithm irrespective of the computer on which it will be used. Hence identify the key operation and count such operation performed till the program completes its execution.

The time complexity can be expressd as a function of a key operation performed.

The space and time complexity is usually expressed in the form of function f(n),where n is the input size for a given instance of a problem being solved.

f(n) helps us to predict the rate of growthof complexity that will increase as size of input to the problem increases.

f(1) also helps us to predict complexity of two or more algorithms in order ro find which is more efficient.


Written by
deven rana
\"Live as if you were to die tomorrow. Learn as if you were to live forever.”
  • No comments found

Latest Articles

Photo from The Indian navy has a long and checkered history and was a creation of the English
The last week has been a traumatic period for the world. There have been at least 5 terror attacks and in one of the most reprehensible incidents an old
I still have memories of my college days and they are the best ones. Not because it was fun but because of the rigorous development we had to undergo.

Related Articles

It's been two weeks since Apple has announced their smart watch or simply - Watch, along with iPhone 6 and the release of iOS 8. Apple Watch is not yet
New technologies in the dynamic arena of IT keep on certain flares in the media and on the net. It must have wondered how fast this growth engine is. But
In Android, just like in Windows, if you want to view a document containing a non-Unicode font, the font must be installed in the system first. Now the
Introduction:  The power of connectivity cannot be overstated if you use mobile phone for calls and text messages. If your mobile phone as sufficiently
Every day a new 3-D Printer is being launched in the markets around the world. According to many experts 3-D Printers have the potential to change the