1. recursion forums.oracle.comHi guys..hope someone can hellp. Been stuck on this for the last 2 days! Write a program to compute a simple 3x3 spreadsheet containing both integers and strings. Firstly, there would be input from the user (in rows  see example below), then perform calculations on the user input as outlined below ...and finally, output the computed spreadsheet as a matrix. ... 
I was just curious because when ever I looked up info on the web all the examples were using two methods thats all. For example one method called powers that would have one parameter and within that method another powers method would be called with 2 different parameters. So i dint know exactly if recursion could be completed with only one ... 
hello all! first of all  i'm not looking for an answer to my homework i'm lazy. but not that lazy...:) since thinking recursively isn't natural to me i am going about it the only way i know solving as many problems i can. i have been searching for a database of questions but the only ones i find are either ... 
It's likely the assignment is supposed to teach you these things in addition to what recursion "is": 1) Letting each recursed method be selfsufficient 2) Letting the recursion unwinding be your "backtracking" Doing these things manually is possible but probably not the point of the assignment. If your recursed methods have to call out to a shared data structure that holds ... 
5. recursion forums.oracle.com 



If it has to be recursive (like for an assignment or something) then, if I'm understanding your problem right, these would be my steps: String clean (recursive): 1. If length of string is less than 2, return string 2. Let X be the first character. 3. Find largest rPos such that each character between 0 and rPos = X 4. Return ... 

boolean replaceBadBytes(int[] badByteIndices, int indexCntr, int[][] possReplacements) { if (indexCntr == badByteIndices.length) { // we're all done  let's see whether this substitution is ok return verifyChecksumMatch(); } // get the "real" index of the int to replace int currReplacementIndex = badByteIndices[indexCntr]; // go through the possible replacements belonging to this bad index and // recurse for (int currReplacement : possReplacements[indexCntr]) ... 
Hi, Can anyone give me advice on the following problem: I have a large 2d array and starting at the right hand bottom corner I am recursively "digging" into it. However sometimes (depending on the dimentions of the array  which depend on two strings that can be of equal or unequal length) my recursion just stalls. I do not get ... 
The point of recursion is to avoid if(N == 1), if(N == 2), else...thats not recursion (it won't work...well it might but you missed the point of recursion). What would happen if I passed your method a multidimensional array with a size of 1000? Are you gonna have that many if statements? a 1000! no. google recursion to figure out the ... 
i am having alot of difficulty in understanding recursion and for a review question i am having difficult doing it. The problem is having a person input how many chicken nuggets they want and have the program say if it can be sold evenly using 6,9,20 packs of nuggets Edited by: mike_eriksen on Feb 22, 2008 10:03 AM 

Recursion isn't some way to avoid infinite loops. You can have nonterminating recursive functions just as you can have nonterminating loops. (Well, except that you're likely to hit some kind of limit, like running out of stack space, a lot faster if you're using recursion. But crashing sooner isn't necessarily an advantage.) Your loop is buggy. Add some debugging code to ... 


Sorry for all our "subtleties", bharathi1. This was probably bad experience with the forum for you (4 posts):  Adding one hint without getting any feedback  Posting a question and repeating the problem in a first attempt.  Not getting a solution but being the source of subtle (?) jokes. Anything smelling like "DO MY HOMEWORK" risks similar responses, but ... 


Hi Prometheuzz, Those combinations are correct, but the number of sets is not known when the program will be executed, and that is why I wanted a recursive solution. if you solution can handle a dynamic number of sets, then please post it. Thanks. Prometheuzz wrote: ============================ et One = {A10, A11, A12} Set Two = {A20, A21} Set Three = ... 
I need help making a recursion method called triple. It takes an integer array as a parameter and triples each integer in the array. The body must look like this: public static void triple (int[] array) { } please help. i dont know how to do this without an integer parameter. I am allowed to use a helper method. 

I understand how to see if an individual string is contained within another string through conventional methods like if I tested one string containing "max" against another containing "amillion max" I would get a true value. However, how in the heck would I do such a thing recursively? It just seems illogical to me when there are easier easier ways. To ... 
Hi, I wonder if u guys can help me, i've written a program, but i need to have it in recursion the following is the code  Thanks public class CW2 { public static int bintodec(String b) { int dec=0; int k; int power=1; for(k=b.length()1; k>=0; k) { if (b.charAt(k) ==1) dec = dec + power; } return dec; } public ... 




rec(6, 7) is invoked. x == 6, and y == 7 here; since y is not equal to 1, it returns rec(6, 6) * 6. This invokes the method again. rec(6, 6) returns rec(6, 5) * 6 rec(6, 5) returns rec(6, 4) * 6 rec(6, 4) returns rec(6, 3) * 6 ... etcetera rec(6, 1) returns 1 instead of recursively invoking ... 

hi all, i am coding FOR DAYS (and nights...) and may be i am to dump to get this working, but i REALLY need an solution...NOW...sorry.... the old game...recursions.... i have the following string: element1, element1.1, element1.1.1, leaf0 looks like: element1 >element1.1 >element1.1.1 > leaf (child) so PLEASE who can helb me to build an vector with this structure? something like ... 
please can any one expailn what does this mean ? Determine what values will be returned by the function calls ff(3,4) and ff(4,2) when the recursive function ff is defined as follows. Include a short explanation why the returned values are exactly those you have determined. int ff (int x, int y) { if (x >= y) return x; return ff(y,x); ... 
Hey, I need help converting the recursive case into a recursive method. For example the recursive case for addtion of two integers is x+(y1)+1 Therefore we get this function: public int add(int x, int y) { if (x==0) return y; else return add(x,y1)+1; } My problem is with multiplication. We find that the recursive case is (x1)*y+y so what would be ... 



Please help, I've been stuck on this for many days. I'm supposed to make a java program that displays the following fractal: http://www.seattlecentral.org/faculty/flepeint/java143/hw3/pluses.gif The first level is displayed upon startup. The level increases everytime the recursive method is called. The variables I have are: type Plus north, south, east, west, parent; The recursive method should create new Plus(int x, int y, ... 



Hey everyone! First time poster here. Have a problem understanding recursion, specifically with the following problem: The game of Jump It consists of a board with n positive integers in a row except for the first column, which always contains zero. These numbers represent the cost to enter each column. Here is a sample game board where n is 6: [0, ... 
43. Recursive forums.oracle.comclass RecTest { int values[]; RecTest(int i) { values = new int; } // display arrary  recursively void printArray(int i) { if(i==0) return; else printArray(i1); System.out.println("[" + (i1) + "] " + values[i1]); } } class Recursion2 { public static void main(String args[]) { RecTest ob = new RecTest(10); int i; for(i=0; i<10; i++) ob.values = i; 

45. recursive forums.oracle.comTry tracing through the program yourself with a piece of paper. I get you started. Lets consider the list has only one item and a reference to this item is passed to the parameter first. Your program intialises the sum variable to zero. Then it hits the if statement. If you have got the IntNode class correct then next will be ... 

Yes you will need to use substring. If you want to reverse "hello" then it is: reverse ello print h reverse llo print e reverse lo print l reverse o print l print o or print o reverse hell print l reverse hel print l reverse he print e reverse h print h 
Cool, now it is getting array out of bounds exception 10, when it runs into the second free textarea, but it is putting 1 in the first, I assume that means it is not backtracking properly, Cheers for the tip tho, at least its moving!! skipping 0 0 skipping 0 1 skipping 0 2 Exception in thread "AWTEventQueue0" java.lang.ArrayIndexOutOfBoundsException: 10 
Right now I am a CS student in high school. I am going ahead of the class and my teacher recommended that I learn recrusion for Java. Can somebody provide a trace or a link to a trace for this. I have been spending the last two days trying to understand the recursion aspect of this problem and I am stuck. ... 

public static void drawPascal (int n) { int k = 0; // This loop is to start from 0 and go up to n in the triangle while (k <= n) { int r = 0; while (r <= k) { System.out.print(((factorial(r)) / ((factorial(k)) * (factorial(r  k)))) + " "); r = r + 1; } System.out.println(); k = k ... 

What do you want it to do? You don't express this clearly. It looks like you have some sort of a data structure and you want to go through the elements in it, is that it? What kind of a data structure is ita tree, a graph, what? Asking "I'm trying to use recursion. How do I do it?" is like ... 

Is there any way to recursively import all the members of all the packages under a package tree? For example, can I import all of java.awt, java.awt.color, java.awt.font, etc. without having to type out each package name separately? I assume no since java treats each of them as completely different packages even though they share the same prefixed "super package," but ... 

Hii Javaties Sorry for postng this question at this forum I have deployed a Message driven Bean(MDB) on weblogic server ,and tht MDB is working fine. But i am getting some problem with JMS , i.e messages that are in message queue are not getting removed even when the messsage is getting consumed., and the result is tht my MDB code ... 
58. Recursion forums.oracle.comHey, I have a program to write and have no clue what to start with. I was asked to write a Recursion program (program that calls itself) about palindromes. What it needs to do is to ask the user for an input of a string, then take that string and check for all possible palindromes inside of it. For example: Able ... 

can someone give me a recursive definition about this problem? how many tree we can have for a given number of nodes? for example, we can have 1 tree for 1 node, 2 trees for 2 nodes, 5 trees for 3 nodes, 14 trees for 4 nodes.. Message was edited by: seiya 
61. Recursion forums.oracle.com1.) I'm pretty sure you get the error message when you run the program, not when you compile it. 2.) Please look at the complete stack trace (and post it here), it will tell you where exactly you've got your problem. 3.) The reason is probably the line that says "int N = Integer.parseInt(args[0]);". You are parsing the first argument passed ... 

63. Recursion forums.oracle.comCould you give me an example of how to go through an array of numbers using recursion? I have to go through the array and return the highest of all the odd numbers and the highest of all the even numbers. Is it possible to return 2 different numbers? edit: I'm trying to use your 2nd option, but im not sure ... 
I would note two things: 1. Each number of asterisks needs to be printed exactly twice and in a specific order. The first printed must be the last printed. What does that tell you about where your recursive call might be located relative to the two print expressions? 2. The first thing printed should be the minimum number of asterisks. The ... 
65. Recursion forums.oracle.comHi, I'm a second semester cs student and I am having difficulty finishing my recursion program. The problem is to: write a recursive method that takes as a parameter a nonnegative integer and generatesthe following pattern of stars. If the nonnegative integer is 4, then the pattern generated is: **** *** ** * * ** *** **** Seems simple and after ... 
EJP wrote: This is a poor solution to a simple problem. There is bo reason to use recursion here. Iteration is perfectly adequate in this case. In general recursion without parameter passing or a return value is pointless. Yeah, you're right; it seemed like an odd way to do things when I looked at it. I was referring more to jschell's ... 
I've gotten some suggestions that it might be due to the "cd" command acting wonky. I've gotten other suggestions that it may be some strange setup with the env variables (My Mac developer is implementing a fix/workaround for 'environ', which is apparently posix standard, but Mac (Mr. Posix Compliance...) doesn't implement it. When he finishes that, I'll know whether it worked ... 
When I was stepexecuting I tried N = 4 in order to look at simpler case. I understood that the author is using q[] to know what the position of the Queen is. But how is it done and most of all how the backtracking recursion is implemented is what I don't understand. Any help is greatly appreciated. Thanks in advance. ... 
I understand it. But as soon as I change something ( because I want to make sure that I really understand the topic ) I got confused again. I apologize for being so persistent. My questions might look stupid for some of you, guys but I want to understand what / why is going on when I have "double" ( or ... 

Can someone, please help me understand why the above code calculates a*b ? I tried with pen and paper  don't get it, tried with debugger  same result. Tried with System.out.println(mystery(a,b)); just before every return statement in effort to enlighten the case and I got StackOverflowError. Thanks in advance. Edit: I got it why the stack overflows when I recursively ... 


