0

which one is efficient ? calling a fun repeatedly for getting a value ! r storing them in a single variable(allocating space)

eg: calling Time fn/class in any lang fr N times or assigning it to a variable !

31st Oct 2017, 6:46 AM
Abishek Robin
Abishek Robin - avatar
3 Réponses
+ 5
storing them is definitely faster
31st Oct 2017, 6:49 AM
Sahaj Bamba
Sahaj Bamba - avatar
+ 4
since they can be easily searched and accessed. You can even use hashing for even faster access If you need to calculate in a small domain plus quite some test cases.
31st Oct 2017, 6:56 AM
Sahaj Bamba
Sahaj Bamba - avatar
+ 3
tq fr ur response Sahaj !
31st Oct 2017, 7:04 AM
Abishek Robin
Abishek Robin - avatar