What is Space complexity and Time complexity. Explain me with examples.

I need answer as soon as you can. I did not find the best answer in my book. Please explain me properly.
Written by Category: Education & Reference 8 years ago
Harsha
Asked

Like it on Facebook, Tweet it or share this question on other bookmarking websites.

Time complexity is a function which describes the amount of time an algorithm takes in terms of the amount of input to the algorithm.

Space complexity is a function which describes the amount of memory (space) an algorithm takes in terms of the amount of input to the algorithm.

EXAMPLE:

The complexity of linear search algorithm for avarage case
c(n)=1*1/n+2*1/n+3*1/n+.........+n*1/n
=(n+1)/2
Karuna Sapra
Answered

The amount of computer time the program needs to run it to completion. is known as Time complexity.
The amount of memory it needs to run to completion is known as Space complexity .
rambabu
Answered

Time complexity is the amount of time taken by an algorithm to run as a function of the length of the string representing the input. For example, if the time required by an algorithm on all inputs of size n is at most 5n3 + 3n, the asymptotic time complexity is O(n3).
Space Complexity of an algorithm is total space taken by the algorithm with respect to the input size.
V.Arunkumar
Answered

Please register/login to answer this question.  Click here to login