- #1
evinda
Gold Member
MHB
- 3,836
- 0
Hello! (Smirk)
Suppose that we have an algorithm of the form:
where P is the root of a binary tree, for example this one:
View attachment 3616
When we call the function [m]Algorithm(a)[/m], [m]s[/m] will get the value $0$.
After that, we call the function Algorithm(b). Does [m] s [/m] get again the value $0$, or not, because of the fact that it is static? (Thinking)
Suppose that we have an algorithm of the form:
Code:
Algorithm(NODE *P){
static int s=0;
Algorithm(P->RC);
......
Algorithm(P->LC);
......
s++;
}
where P is the root of a binary tree, for example this one:
View attachment 3616
When we call the function [m]Algorithm(a)[/m], [m]s[/m] will get the value $0$.
After that, we call the function Algorithm(b). Does [m] s [/m] get again the value $0$, or not, because of the fact that it is static? (Thinking)