Tagged Questions

This is implemented as a function which calls itself. Some functional programming languages do not define any looping constructs, but rely solely on recursion to repeatedly call code. Likewise, in languages that do provide loops, it is possible for any recursive function to be written using loops ...

learn more… | top users | synonyms (1)

0
votes
0answers
20 views

can public method call itself recursively

what for (potential usage): e.g. to use for recursive dir traversing (BTW: I know about RecursiveIterator) some (rough) idea example class some_class { public function some_method() { if ...
3
votes
1answer
23 views

Ruby recursion issue

I wonder why the first approach to factorial does not work (infinite loop) in ruby while the second does. def fac (x) if x == 0 return 1 else return (fac (x-1) * x) end end def fact( ...
-1
votes
1answer
43 views

Why does this message print extra times (more than I want it to print)?

import java.util.ArrayList; import java.lang.Math; public class War { ArrayList deck = new ArrayList(0); ArrayList player1 = new ArrayList(0); ArrayList player2 = new ArrayList(0); ...
0
votes
2answers
26 views

jquery how to pass variable from the last iteration?

I'm having an each loop though the objects, And in it, I create some images, and I want to put into them a data of the reference to an image from the last iteration. For example: ...
1
vote
3answers
37 views

JavaScript + recursive function returning undefined

I have a simple html structure that I need to traverse. For some reason my recursive function returns 'undefined' on any nested nodes, but not for parent nodes. Unfortunately this needs to be native ...
8
votes
1answer
141 views

Trouble designing recursion with limited results

I'm having trouble fixing this problem; it's been plaguing me since yesterday (sorry, I posted this earlier then deleted it because I thought I solved it but it turned out to be another bug I fixed). ...
0
votes
0answers
28 views

Sort single-dimension associative array into multi-dimensional tree

http://pastebin.com/fvJ1Q0FC — Testing-ground... I have array (Line 60) that represents database data with structure: +----+-------+-----------+ | id | title | parent_id | ...
1
vote
3answers
58 views

Decorating recursive functions in python

I am having hard time understanding how a decorated recursive function works. For the following snippet: def dec(f): def wrapper(*argv): print(argv, 'Decorated!') return(f(*argv)) ...
2
votes
1answer
34 views

Convert a series of parent-child relationships into a tree?

I am terribly stuck. I think I need to write a recursive method but I can't work out how...! I am trying to convert an array of parent-child relationships into a hierarchical tree which I will later ...
0
votes
0answers
6 views

SSRS 2005 parent/child grouping with toggle - losing rows

Stored procedure uses CTE to generate hierarchy. SSRS 2005 report groups on child with toggle on parent. There is no sorting or further manipulation of data but grouping appears to randomly either ...
2
votes
0answers
23 views

How can I configure call depth in powershell?

I was just trying things in powershell and got error about call depth being set to 1000 in some test recursive function. I looked on the internet for some info and found that this is due to error ...
0
votes
4answers
46 views

Calling PHP function in itself

In the following script function clean($data) calls it within it, that I understand but how it is cleaning data in the statement $data[clean($key)] = clean($value);??? Any help is appreciated.. I am ...
0
votes
2answers
55 views

assigning all combinations of a variable number of variable objects

I'm having difficulty with this recursion problem. I thought I had an answer to it but it doesn't work, and I simply don't know why, so I thought I would ask the experts. Please go easy on me, I ...
-2
votes
5answers
45 views

PHP script to traverse directory/file tree and output tree as nested ULs

I have a tree of directories, sub-directories, and files (in some but not all the directories). Here's an example of the whole tree: /food /food/drinks /food/drinks/water.html /food/drinks/milk.html ...
0
votes
1answer
15 views

Magento and recursion

I've spent a good couple of hours on this and could use a second pair of eyes. I'm using Magento and want to print a 'text hierarchy' of categories. Something like: Default Category > ...

1 2 3 4 5 281
15 30 50 per page