0
votes
5answers
61 views

a simple Java recursion with some kind of bug I don't get

public class test { public static void main (String[] args) { System.out.print (prod (1, 2)); } public static int prod (int m, int n){ if (m == 0) { return ...
1
vote
4answers
103 views

Recursion issue?

So this is my first recursion function (I hope!) and I'm unsure why it isn't working, (aka red lines) any ideas? int myFactorial(int C) { //underlined, expects ";" int n = ...
0
votes
1answer
51 views

Java Stackoverflow Error Recursion

This code I have written works great until a certain input size. If the input gets too large, I get a "java.lang.StackOverflowError". I have read some other entries on stackoverflow regarding this ...
0
votes
1answer
64 views

Recursive parameters for quicksort

I'm trying to implement a simple Quicksort Algorithm (Doubly Linked List, circular). The Algorithm works pretty well, but it's much too slow, because of the following operation: iEl = ...
1
vote
2answers
69 views

Tower of Hanoi recursion java

Here's my java code for solving Tower of Hanoi using recursion: /**here is a stack of N disks on the first of three poles (call them A, B and C) and your job is to move the disks from pole A to pole ...
0
votes
0answers
52 views

OutOfMemoryError: Java heap space for saving into HashMap

JAVA RCP application, Windows 7 32bit, jdk1.6.0_21, Eclipse Indigo, We have two revisions of same XML. Both are unmarshalled to tree. Then revisions are combined to make a superset Tree. On ...
3
votes
3answers
99 views

Summing within a recursion

Summing within a recursion: Does it always produce a StackOverflow Error? public final static float getAlpha(int t, int i, int N, float[] P, float[][] B, float[][] A, int[] O) { float alpha; ...
-4
votes
1answer
67 views

I have a recursion function issue? [closed]

This is my first recursion problem and I'm not understanding it, nor does it work. Any ideas? int C; int myFactorial; int n = Integer.parseInt(objectsChooseField.getText()); ...
0
votes
0answers
36 views

Quicksort overflow in java: recursion depth limit? [closed]

I'm in a basic programming class, now working on my own QuickSort algorithm. I'm pretty confident the code works (at least, it always sorts for array sizes ≤6 indices) but at ≥7 array indices, it ...
-1
votes
1answer
54 views

Java Recursive efficiency analysis

I need help creating an efficiency analysis for a method like this one below. I need to come up with: Factors that influence runtime What is being counted(comparisons, operations)? Best/Worst Case ...
-1
votes
2answers
69 views

Recursion - returning a new number with bigger digits than the parameter

I have an exercise in which I have to write a recursive method that receives an integer and a digit d. This method has to return a new number, consisting only digits which is bigger than d. for ...
0
votes
3answers
74 views

finding the largest digit in an integer using recursion

I have a practice who's task is to find the largest digit in an integer using recursion in java. For example, for the number 13441 the digit '4' will be returned. I have been trying for a day now and ...
0
votes
3answers
62 views

Recursive Constructor Invocation

public class LecturerInfo extends StaffInfo { private float salary; public LecturerInfo() { this(); this.Name = null; this.Address = null; this.salary=(float) 0.0; } public ...
-3
votes
2answers
147 views

How to use recursion to round a decimal to the nth place

I have a comp sci question that requires the following: Write a method that takes a decimal number x and an integer n. Round x to n decimal places (for example, 0 means round to the nearest integer, ...
0
votes
2answers
21 views

Use recursion to count the number of nodes whose value field is between min and max, inclusive, from the “cur” node to the end of the list

My attempt at a solution, I know it is not right because the output for the program is incorrect. What am I doing wrong? I have an inner node class, each with value fields.This method should return ...

1 2 3 4 5 82
15 30 50 per page