Written by deven rana. Posted in Computer Science on 09 August 2011.
Hot 5381 hits 0 favoured




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.


deven rana

Author: deven rana

17 8345 4
\"Live as if you were to die tomorrow. Learn as if you were to live forever.”
  • No comments found
Powered by CjBlog

Latest Articles

There is a big influx of Muslim refugees  from the arc around the Mediterranean Sea to Europe. The reason is strife, where food is scarce and life
At long last the Russians under  Vladimir Putin intervened in Syria to support their long time ally Assad. It was a terrific moment as for the first
Cervical agony is chiefly brought about because of debilitating of the joints that hold the neck, any issues relating to the back, spinal string or neck


Related Articles

Han Suyin was a famous writer of Chinese origin. This was her pen name. Her real name was Rosalie Matilda Kuanghu Chow.She was  probably born in 1916
The Lord declared that whenever there was degeneration of virtues he would come again to establish dharma. And, twelve hundred years ago, when the Sanatana
Chanakya, the master of practical diplomacy, is accepted and admired as a daring genius by the Indian and Western scholars. This greatest diplomat of the
Raj Kapoor Birth Date - 14th December 1924   Death Date - 2nd June 1988 Raj Kapoor titled with “The Show Man" as well as "Charlie Chaplin
Mother Teresa All of us know her as Mother Teresa but she was born at Skopje now capital of Macedonia, on 27 August 1910 with the name Anjeze Gonxhe Bojaxhiu