0

Complexity

what are different space and time complexities

14th Sep 2018, 4:21 PM
Elizabeth_de_luca
Elizabeth_de_luca - avatar
3 Respostas
+ 8
As I understand the time is that required to take amount of input while space is the amount of memory required that amount of input.
14th Sep 2018, 4:30 PM
Nilavarasan
Nilavarasan  - avatar
+ 5
These two concepts are used to measure an algorithm. Space refers to the memory space required while time refers to the time taken or generally no. of interation in Big-O-notation. Most of the time it's about the trade-off between the two. For example if we want to determine the nth perfect square we can either:- [ TIME ] ☑ Write a loop which iterate n times to compute the result ▫More runtime, less space required or [ SPACE ] ☑ Initiate an array to store an arbitrary large number of perfect squares beforehand and just use its index to determine the result ▫ More space, less runtime required
15th Sep 2018, 12:10 AM
Zephyr Koo
Zephyr Koo - avatar
+ 3
Well according to my understanding, time is something like you check a particular algorithm or code that how much time it took to get executed. And space is checked like how much memory will the program take during its execution. Correct me if I am wrong :)
14th Sep 2018, 7:14 PM
blACk sh4d0w
blACk sh4d0w - avatar