Пожалуйста, прочтите новое правило об ограничении использования AI-инструментов. ×

Looping through a tree

Правка en3, от MMM24, 2015-07-11 02:10:50
Hi all.
I have the following code

void f(int x)
{
  if(x<0||x>10000) return ;
  f(x-1);
  f(2*x);
}

When this code is executed it will start from left (x-1) untill he reach the last element and then go to the right and so on

![ ](http://im58.gulfup.com/xFtvz6.png)

How ever i want it to proceed from up to down like in the picture

![ ](http://codeforces.net/predownloaded/30/8c/308cabbc5a6825659c5af310f330c451b263aee5.png)

Any helps.
regards.
Теги tree

История

 
 
 
 
Правки
 
 
  Rev. Язык Кто Когда Δ Комментарий
en4 Английский MMM24 2015-07-11 02:12:04 36
en3 Английский MMM24 2015-07-11 02:10:50 22
en2 Английский MMM24 2015-07-11 02:09:25 35
en1 Английский MMM24 2015-07-11 02:07:31 535 Initial revision (published)