, , , ( " ... " ).
, :
int recursive_function(int x)
{
if (1 == x)
return 1;
int scratchpad[100];
...
return recursive_function(x-1) + scratchpad[x-1];
}
, ( , 100), , - , , , .
, scratchpad 400 ( 32- , 800 64- ) recursive_function(), , recursive_function() 100 , 40 000 ( 80 000 64- ) , , :
int recursive_function(int x, int* buffer, int buffer_length)
{
if (1 == x)
return 1;
...
int temp_value = buffer[x-1];
return recursive_function(x-1, buffer, buffer_length) + temp_value;
}
, std::vector, , ( [. ], , ).
40k 80k , . , , ( , , , ).
, . , . , .
: STL, , . , ; , , , . , , - , : STL, , , .
"", , ( - ), , , , , . , std::vector , .