Guest User

Untitled

a guest
Sep 12th, 2018
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.42 KB | None | 0 0
  1. Changing from recursion to iteration
  2. void func(int a, int b, int c, int d) {
  3. //something
  4. //non-recursive
  5. //here..
  6.  
  7. for (i=0; i<data.length; i++) {
  8. if (!data[i].x) {
  9. data[i].x = 1;
  10. if (a == data[i].value1)
  11. func(data[i].value2,b,c,d);
  12. else if (a == data[i].value2)
  13. func(data[i].value1,b,c,d);
  14.  
  15. data[i].x = 0;
  16. }
  17. }
  18. }
Add Comment
Please, Sign In to add comment