Recursion in computer science is a method of problem solving where the solution to a problem depends on solutions to smaller instances of the same problem.
0
votes
0answers
6 views
Twitter4j - Searching user tweets recursively
I want to get user tweets in a recursive way with twitter4j, it is actually pretty much like browsing a user timeline, then picking another user which is a follower of the user and getting their ...
0
votes
2answers
59 views
Algorithm for obtaining a sum with minimum number of terms
The problem statement is following:
Given N. We need to find x1,x2,..,xp such that N = x1 + x2 + .. + xp, p must be minimum(means number of terms in the sum) and we also must be able to get all the ...
0
votes
0answers
57 views
Speed up Slow Recursion
In C# I am getting an unordered list from the database that has items with their ID plus the ID of their parent. The code below works, but it's so slow.
How can I speed it up?
The slowness seems ...
0
votes
4answers
37 views
What is wrong with my Fibonacci sequence calculation in Python?
I am new to Python and would like to know if recursion works at all. I can't get my code running. It is supposed to print all the the fibonacci numbers:
#!/usr/bin/python
import time, sys
def ...
1
vote
1answer
29 views
Huffman Encoder - Recursive, coding function fail
I'm working on a Huffman code generator. Below is my function to make up the tree. The tree is based off a vector of object pointers. I have checked and it seems to be working properly. I would now ...
1
vote
1answer
48 views
StackOverflowException on recursive anonymous funtions
I'm trying to write a function to check whether a string is a palindrome, and using this example, I'm trying to reverse the string using a recursive anonymous function:
static Boolean ...
0
votes
3answers
39 views
How to actually work with immutable lists in Java with the limited stack?
I'm working with an API that gives me large immutable lists which look like this:
class List<T> {
final T e;
final List<T> next;
public List(T e, List<T> next) {
...
0
votes
0answers
7 views
FileStatus use to recurse directory
I have following directory structure,
Dir1
|___Dir2
|___Dir3
|___Dir4
|___File1.gz
|___File2.gz
|___File3.gz
The subdirectories are just nested and donot contain any files
I ...
-1
votes
0answers
72 views
How can I generate all possibility using recursion?
I have a recursive function to generate matrices, called lights.
This function is called in light_and_color.
light_col_permutation, called in lights, gives a vector of vector of vector of int.
So, ...
0
votes
1answer
28 views
recursive creation of tree java
I am trying to create a JTree of a file system by giving the path of rootfolder,
But at first I am trying to create and print nodes upto the leaf node by recursion.
below is my code ,I am not getting ...
1
vote
0answers
17 views
maximum recursion depth exceeded on Django model when creating
I have this strange problem with one of my Django models and I was able to fix it but don't understand what is happening.
These are the models:
class Player(models.Model):
facebook_name = ...
0
votes
3answers
57 views
How to think in recursive way?
In order to understand the advanced algorithm concepts like greedy methods and dynamic programming,one first need to be well versed in recursion.I am relatively new to recursion.Whenever a question is ...
0
votes
3answers
59 views
Algorithm for generating size n combinations of k characters
I need an algorithm which generates all the combinations of size n of k characters.
If for example I have n=1 and k={a,b}, the result should be:
a
b
If n=3 and k={a,b}, the result should be:
a a ...
0
votes
2answers
114 views
divide n players to m teams to minimize the team difference in Java
I am stuck with a problem and I need some help from bright minds of SO. I want to divide n players to m teams. Each player has different game abilities. Abilities are represented by positive or ...
6
votes
3answers
56 views
How are variables stored in memory in recursion?
I'm unsure about how variables are created and stored in memory during recursion. Below is an example taken from C Primer Plus:
#include <stdio.h>
void recursiontest(int);
int main(){
...