2
votes
1answer
60 views

Iterative Collatz with memoization

I'm trying to write efficient code for calculating the chain-length of each number. For example, 13 -> 40 -> 20 -> 10 -> 5 -> 16 -> 8 -> 4 -> 2 -> 1. It took 13 iterations ...
2
votes
1answer
164 views

Recursion and iteration how can i optimize this code

I have written some code which will fetch contents from a resource which is actually stored in a tree format. Since it is in a tree format, there will be a parent-child relation and hence recursion. ...
1
vote
1answer
38 views

Improve file-path finding method

I am using a recursive algorithm to find all of the file-paths in a given directory: it returns a dictionary like this: {'Tkinter.py': 'C:\Python27\Lib\lib-tk\Tkinter.py', ...}. I am using this in a ...
0
votes
2answers
5k views

Create a list of all possible combinations of elements into n-groups from a set of size k

I'm trying to write a Java program that, given a particular number of groups and number of total participants, creates a list of all possible ways to fill that number of groups evenly using all the ...
0
votes
0answers
197 views

Code Improvement on generating Tree Structure

I'm using actionscript/flex 4.5 I have a Class (DEF) with three main properties COD_CLASSE is the ID of the object COD_CLASSE_PADRE is the ID of the parent of the object children is an ...