250 Topics

Member Avatar for
Member Avatar for hennelh

I have a list of productions. There are several instances of left recursion in it. I'm having trouble eliminating them even after reading my notes and the textbook on it. *Production* (With AST definition) MuMu-program: declaration-list; stmt-seq {Mumuprog l: id r: stmt} stmt: id := expr {assstmt l: id r: …

Member Avatar for hennelh
0
238
Member Avatar for Delocaz

I'm looking for how to brute-force the result of something like [ICODE]"Hi".hashCode()[/ICODE]. I have no idea where to start. I looked for the answer for like 5 hours yesterday. It's for reversing Minecraft seeds. (seed-to-text). I tried my own solution. It's too crap to even post. I tried to find …

Member Avatar for Delocaz
0
1K
Member Avatar for ARaza110

[CODE]public class cation { public static void main(String[] args) { new cation().run(); } public void run(){ harada hara=new harada(); insert(hara); insert(hara); } public void insert(harada hara){ if(hara.left==null){ hara.left=new harada(); } else{ insert(hara.left); } } class harada{ harada left; public harada(){} } } [/CODE] Can someone please explain, recursion in objects …

Member Avatar for ARaza110
0
167
Member Avatar for transplantedNYr

Now this question is being written in Scala, but Scala is Java compatible. I will translate the java code into Scala. // Write a recursive function "upto" // that takes two Int parameters "start" and "end" and produces a "List[Int]" // that counts DOWN from "start" to "end" (inclusive at …

Member Avatar for transplantedNYr
0
188
Member Avatar for dolfan55aj

I'm a new member and this is my first post, so be gentle ;) It's been a while since I've gotten a chance to practice with recursion so to say I'm a bit rusty is an understatement. Not to mention I've never implemented it with a linked list. My current …

Member Avatar for mike_2000_17
0
521
Member Avatar for now how abt tht

I have the following code for shell sort (recursive) given in the question where t[ ] is an array to be sorted, n=no of elements initially. h is any large no initially,say h>n. [CODE]void shell_rec(int t[],int n,int h) { int aux,i; if(h<=0) return; if(n>h) { shell_rec(t,n-h,h); if(t[n]<t[n-h]) { aux=t[n]; i=n; …

Member Avatar for Adak
0
499
Member Avatar for hawx

I have created a recursive function to get parent products of a product. I'm almost sure I'm nearly there, but need help snapping out of recursion. The result I am looking for is something like: Product 1 (id:1, parent:none) --- Product 2 (id:2, parent:1) --- --- Product 3 (id:3, parent:2) …

Member Avatar for Morta
0
109
Member Avatar for xellos

ok i have a perl script [CODE]use strict; use warnings; open(my $in, ">>", "log.txt") or die "cant open log.txt $!" ; my @files = <*>; foreach my $file (@files){ print $in $file . "\n"; } close $in or die "$in $!";[/CODE] it gets the filenames that are in the same …

Member Avatar for d5e5
0
145
Member Avatar for PHkiDz

please help me in my code the error appears and i can`t figure it out. i used to write a program that will accepts the user input, but only a word then the program will scramble the word that had been inputted by the user and display it on JFrame(WINDOW) …

Member Avatar for peter_budo
0
182
Member Avatar for blivori

Hi, I created a Python script using pyPDF that automatically merges all the PDFs in a folder and puts them into an output folder and rename them automatically as per the folder's name. What I want to do now is for the script to search for sub-directories, process all the …

Member Avatar for blivori
0
222
Member Avatar for vishal1949

I am making a program where i have to write a recursive function that reverses a string. I am a new programmer and need help. The function should return a String and take only one argument, also a String. [CODE]import java.io.*; public class RecursiveFunction { public static void main(String [] …

Member Avatar for JeffGrigg
1
385
Member Avatar for altarek

Hi i have sub-directories like this (files/dir/dir2/) and have input text I want to get all the doc files in the sub-directories when insert name of top directory (files)in the text field

Member Avatar for vibhaJ
0
172
Member Avatar for tgreer

Since it's been about three years since I had to write any XSLT, I'd like some assistance with the code below. [CODE]<?xml version="1.0" encoding="UTF-8"?> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="2.0"> <xsl:output method="text"/> <xsl:template match="/"> <xsl:for-each select="/WatchConfig/ProcessList/Process/Node"> <xsl:if test="Plugin = 'PWScript'"> <xsl:text> </xsl:text> <xsl:value-of select="Config" disable-output-escaping="yes" /> <xsl:text> ************************************************************************ </xsl:text> </xsl:if> </xsl:for-each> </xsl:template> </xsl:stylesheet>[/CODE] …

0
175
Member Avatar for Nicco

Hi there, I'm working on a map for a class assignment and running into trouble. I've tried looking around the web but couldn't find anything that helped. I know how insertion works on a basic level when returning a node pointer but think i'm missing some key ideas when using …

Member Avatar for Nicco
0
2K
Member Avatar for sajay

Hello I'm coding an algorithm based on genetic programming with tree structures in C. I implemented tree structure using recursive structure pointers **The traditional way** [CODE] struct tree { int val; tree *left; tree *right; }; tree a[10]; tree b[20]; void main() { generate (); // this generates me 10 …

Member Avatar for sajay
0
186
Member Avatar for Ahmed sunny

hello.. [COLOR="Red"]i need code for finding all possible combination of repetitive characters using recursion function.[/COLOR] actually the question i s "Imagine a robot sitting on upper left corner of NxN grid. the robot can only move in two direction "Right" and "Down". write a recursive function to find all possible …

Member Avatar for predator78
0
384
Member Avatar for gynmd

hello, can someone explain me how this printf inside the function works? [CODE] #include<stdio.h> #define SIZE 10 void function(int [],int); int main() { int a[SIZE]={32,27,64,18,95,14,90,70,60,37}; function(a,SIZE); return 0; } void function(int b[],int size) { if(size>0){ function(&b[1],size-1); printf("%d ",b[0]); } } [/CODE]

Member Avatar for gynmd
0
170
Member Avatar for Billy D

[CODE]string currentUser() { string user; ofstream outf("CurrentUser.dat", ios::trunc); system("whoami >> CurrentUser.dat"); outf.close(); ifstream inf("CurrentUser.dat"); inf >> user; return user; }[/CODE] This is a function that gets the name of the current active user. It creates a data file, with the contents being the username. The problem is, to create a …

Member Avatar for TrustyTony
0
179
Member Avatar for s11049151

hey, I have to write a program that asks the user for an input amount (in cents) and the highest denominations of change (1c,5c,10c,20c & 50c). With these 2 inputs, the program then finds the distinct ways in which the change for the given amount can be made using the …

Member Avatar for daviddoria
0
266
Member Avatar for rena0514

My program is suppose to create a two dimensional array that is read from a file. And use a recursive function to find how many white areas ('w'). My program runs with no errors but i cant get any response from my recursive function. Cpp file: [CODE]/* This program accepts …

Member Avatar for rena0514
0
215
Member Avatar for SCass2010

Hi everyone, As part of an assignment we have to develop a recursive backtracking solution in java to a sort of knapsack problem - you have a 150mm bar, a set of orders you have to cut and you need to come up with the best solution that gets the …

Member Avatar for bibiki
0
682
Member Avatar for Labdabeta

I have the following trig functions, but I am wondering if there is a faster algorithm that I could implement: [CODE]static const double SINMIN=0.0009999998333333; static const double COSMIN=0.9999995000000417; static const double TANMIN=0.0010000003333334; static const double E=2.718281828459045235360; static const double PI=3.14159265358979323846; static const double MINVAL=0.01; double sin(double ax) { double x=aabs(ax); …

Member Avatar for mrnutty
0
626
Member Avatar for jonpadre

I am currently attempting to write a single [B]recursive[/B] method (per instruction) whereas the items in a binary tree are displayed in a horizontal hierarchical manner (level order traversal). The UML describes the method as: levelOrderTraversal(TreeNode<T> tree, Integer indent) - tree: a node in the binary tree - indent: describes …

Member Avatar for jonpadre
0
196
Member Avatar for bensewards

Hey everyone, I have to manipulate two functions RECURSIVELY, strlen and strcpy. I was able to code the strlen: [CODE]int length(char* str){ if(str == NULL){ return 0; }else{ return length(str, 0); } } int length(char* str, int l){ int len=0; if(str[l]){ len = length(str,l+1); } else { return l; } …

Member Avatar for bensewards
0
744
Member Avatar for dunderMiflin

I am a 22 year old college gal currently enrolled in a c++ course, and we are on the topic of recursion. I understand how it works and have completed several other exercises on the professor has listed in the book, but this one has me stumped. Is there anyone …

Member Avatar for Insensus
0
230
Member Avatar for chiefpf

I need to write several algorithms and one is giving me trouble. The one giving me issue requires the use of recursion to produce a summation for an integer. For example summation(4)=0+1+2+3+4=10. The code I am working with is: [CODE] public long recursion(int N){ if (N <=1) return 1; else …

Member Avatar for masijade
0
2K
Member Avatar for SMITA6076

[B]For the error and my question, skip to the bottom. I just posted all of the code in case it's needed.[/B] [CODE]/*********************************************************************************** * * File: Customer.java * * Author: Austin Smith * * Date: 04/04/2011 * * Description: The Customer class handles all client information * such as name and …

Member Avatar for SMITA6076
0
239
Member Avatar for Mizki

How to write the recursion code in calculating the sum of the array elements at odd value? I understand the factorial example using recursion, but I am having a really big trouble when writing the recursion codes to perform anything else on my own :/ Please help with this task …

Member Avatar for Mizki
0
3K
Member Avatar for sheylashy

I want to reverse and array of integer recursively, I think this is the way but I get this error when trying with a 5 integer array: Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 5 at name.of.package.ArrayAscDesc.CambioAscDesc(ArrayAscDesc.java:12) at name.of.package.ArrayAscDesc.main(ArrayAscDesc.java:34) Here's the code: [code]import java.util.Scanner; public class ArrayAscDesc { public static int[] CambioAscDesc …

Member Avatar for JamesCherrill
0
395
Member Avatar for jsp01

Hey everyone, I've got a question where I'm sort of stuck on writing a java code for a recursive "school method" multiplication where we have input 'n' and two n digit numbers 'a' and 'b' where the output is m=a.b. I also have to use an array representation for representing …

Member Avatar for Darryl.Burke
0
227

The End.