non-recursive Questions

8

Solved

I have function public static int func(int M,int N){ if(M == 0 || N == 0) return M+N+1; return func(M-1, func(M, N-1)); } How to rewrite it in non-recursive style ? Maybe, is it implementation...
Santalaceous asked 24/5, 2012 at 17:21

6

Solved

I'm looking for a way to do a non-recursive os.walk() walk, just like os.listdir() works. But I need to return in the same way the os.walk() returns. Any idea? Thank you in advance.
Syngamy asked 7/11, 2010 at 11:57

2

I ran into a Rustlings exercise that keeps bugging me: pub fn factorial(num: u64) -> u64 { // Complete this function to return factorial of num // Do not use: // - return // For extra fun d...
Extempore asked 24/3, 2020 at 16:53

30

Solved

What is the algorithm for doing a post order traversal of a binary tree WITHOUT using recursion?
Amedeo asked 18/8, 2009 at 15:37

15

Solved

I am able to understand preorder traversal without using recursion, but I'm having a hard time with inorder traversal. I just don't seem to get it, perhaps, because I haven't understood the inner w...
Inspissate asked 22/1, 2010 at 10:44

3

git log -p . only within the current directory but not in subdirectories equivalent svn log --diff --depth files . Is it possible?
Pucida asked 12/9, 2015 at 15:58

1

I am trying to write a real time ray tracer using compute shaders in opengl 4.3. I know that this is a rather popular question. I have checked this, and this, but the architecture provided over th...
Hanway asked 27/5, 2020 at 8:2

7

Recently I needed to implement non-recursive DFS as part of a more complicated algorithm, Tarjan's algorithm to be precise. The recursive implementation is very elegant, but not suitable for large ...

3

Solved

A few weeks ago, I checked out our whole SVN repo in --non-recursive mode. Now it seems that when I do a svn up, it does not update the folder recursively. It's a problem because I'd like to get t...
Pharisaic asked 14/2, 2012 at 17:12

10

I've checked out a copy of the SVN branch (my branch) locally to which I've merged from a different branch (which has a completely different folder structure). So basically there are a lot of delet...
Spine asked 22/10, 2012 at 10:58

13

Solved

I have spent lots of time on this issue. However, I can only find solutions with non-recursive methods for a tree: Non recursive for tree, or a recursive method for the graph, Recursive for graph. ...
Delija asked 2/2, 2014 at 8:58

3

Solved

I'm struggling with this problem, which I want to solve in non-recursive way. There seems no logic error in my algorithm, 73% test cases passed. But it can't handle the big data, reported "Time Lim...
Bouncy asked 24/9, 2016 at 14:23

7

Solved

Given this algorithm, I would like to know if there exists an iterative version. Also, I want to know if the iterative version can be faster. This some kind of pseudo-python... the algorithm retu...
Mistymisunderstand asked 25/10, 2008 at 3:52

4

Solved

We're getting StackOverflowErrors from Java's serialization library. The problem is that the default serialization implementation is recursive, the depth of which is bounded only by the longest pat...
Davao asked 16/9, 2011 at 1:42

2

I'm working on a small drawing application in Java. I'm trying to create a 'bucket-fill' tool by implementing the Flood Fill algorithm. I tried using a recursion implementation, but it was problem...
Skipper asked 18/2, 2014 at 21:36

4

Can anyone point out a way of getting the depth of a Node in a Binary Tree (not a balanced one, or BST) without using recursion? Ideally in Java/C/C# The node is represented as: class Node { Nod...
Induction asked 17/6, 2009 at 13:1

2

Solved

int s_dynamic(int n,int k) { int maxj = n-k; int *arr = new int[maxj+1]; for (int i = 0; i <= maxj; ++i) arr[i] = 1; for (int i = 1; i <= k; ++i) for(int j = 1; j <= maxj; ++j) a...
Basidiospore asked 27/2, 2011 at 11:50

3

Solved

I'm rewriting some existing code in a setting where recursive calls are not easily implemented nor desired. (And in Fortran 77, if you must know.) I've thought about making a stack from scratch to ...
Commensurable asked 12/12, 2010 at 14:10
1

© 2022 - 2024 — McMap. All rights reserved.