0
votes
1answer
310 views

Decrement operator difference between C++ and Java? [closed]

Please tell me why the same piece of code behaves differently in C++ and JAVA. Ok first I implement a function to calculate the factorial of an Int RECURSIVELY In JAVA: int f(int x) { ...
-1
votes
1answer
163 views

recursion, how many times? [closed]

I am wondering how many times this pseudo code would run and what the total would be I worked it out as 27,000 but this doesn't seem right at all. # At global scope total = 0; # In the function ...
6
votes
1answer
336 views

Is this an example of recursion?

I am implementing inheritance of something called Contexts. Each Context holds a link to its parent context. If that Context is the root Context, its parent is null. In order to walk up the ...
4
votes
4answers
282 views

Is there a way to display the stack during recursion method?

I'm trying to learn recursion. I copied this bit of code from my book and added the displays to help me trace what the method is doing and when. public static void main(String[] args) { ...
6
votes
7answers
1k views

Can a recursive function have iterations/loops?

I've been studying about recursive functions, and apparently, they're functions that call themselves, and don't use iterations/loops (otherwise it wouldn't be a recursive function). However, while ...