250 Topics

Member Avatar for
Member Avatar for rancosster

I am having a problem with my backtracking function it loops with certain data I can't write here the whole program code but can put here my function. [CODE]bool shareMoney(int quantity, int *values, int index, int moneyA, int half, bool *ifChosen) { if(moneyA == half) return true; else if(index >= …

Member Avatar for rancosster
0
127
Member Avatar for ac20734

Hello! I am trying to write a program using recursive functions to identify the path to a given maze. The thing that I am confused about is how to move to the next direction in order to check which way the path goes. For example: 000000 011100 010100 010110 0S00F0 …

Member Avatar for gerard4143
0
230
Member Avatar for ac20734

I need help figuring out how to write a program with recursive functions in order to identify the path to a given maze. The maze is read in from a file and then when the path is found the maze is printed with the path shown. The read in maze …

Member Avatar for gerard4143
0
152
Member Avatar for Prisms

Hello I have been working on this program for a few days and have gotten stuck. I allow the user to enter in a string and remove special characters and turn upper case characters to lower case. after all that is done i compare the characters in the string to …

Member Avatar for Prisms
0
297
Member Avatar for Prisms

Hello I have been working on this program for a few days and have gotten stuck. I allow the user to enter in a string and remove special characters and turn upper case characters to lower case. after all that is done i compare the characters in the string to …

Member Avatar for peter_budo
0
158
Member Avatar for keicola

hi. i made a function which is supposed to create a binary tree from preorder and inorder traversals using recursion. i did this by making arrays for the left subtree and the right subtree in preorder and in inorder at each call of the function. makeNode() puts the data into …

Member Avatar for keicola
0
197
Member Avatar for darelet

Hi all, I'm trying to implement a blob coloring/region labeling algorithm to find and label all blobs/objects in a given image so that at the end of it, I can eliminate all but the largest object. I represented the image by a mask matrix (int binary[image size]) where zero co-ordinate …

0
92
Member Avatar for iskinner

I have XML data where information in nodes relate to other nodes. I am trying to figure out how to generate output based on these relationships. XML sample <gedcom> <indi id="@I001"> <famc>@F002@</famc> </indi> ... <fam id="@F002"> <husb>@I005@</husb> <wife>@I007@</wife> </fam> </gedcom> XSLT sample <xsl:template match="/"> <xsl:apply-templates select="/gedcom/indi[@id='@I001@']"/> </xsl:template> <xsl:template match="indi"> <xsl:value-of …

Member Avatar for xml_looser
0
1K
Member Avatar for TrustyTony

Here is my newest version of the pretty printer I posted earlier. Not doing all that fancy stuff of printing looped recursive structures, but if you put one deeper structure inside flat one, works better for me than pprint module. I do not use often object oriented structures though. Dedicated …

0
657
Member Avatar for RodEsp

Hey guys, so I'm trying to write a little program that will put together any number of strings passed to it into a single string and then print out that string backwards. I think I have everything correct but I keep getting a "Segmentation fault (core dumped)" error after compiling …

Member Avatar for RodEsp
0
1K
Member Avatar for naiksuresh

I am supposed to find a file recursively in a given directory. Rules are not to use find and recursive options like ls -R and grep -r. I can any other other option expect recursive. I had written the script using recursion. [CODE]#!/bin/csh foreach i (`ls -R $1 | grep …

Member Avatar for naiksuresh
0
104
Member Avatar for qingmui

I dont know how to start. I learn python by myself, hopefully i can solve this problem. but i think i need your guys help A palindrome is a sentence that contains the same sequence of letters reading it either forwards or backwards. For example "racecar". Write a recursive function …

Member Avatar for vegaseat
0
762
Member Avatar for jrp370

so i know how to add the numbers in a list recursively [CODE] def ListSum(list): if list = []: return 0 else: return list[0] + ListSum(list[1:]) [/CODE] but how would i go about subtracting a list from a list using recursion? does anyone know how/ where i could go to …

Member Avatar for TrustyTony
0
1K
Member Avatar for Basteon

Hi! I'm writing the mergesort algorithm, theoretically everything is fine in it but when the function gets to call itself the program crashes. I belive that I'm doing something worng when I pass the vector<int> as a parameter to the function. [B]procedure mergesort(T[1 .. n]) if n is small then …

Member Avatar for Basteon
0
1K
Member Avatar for salty11

I need some help with this program, im obviously not so good with this stuff, but since this is the only one i haev left to make i thought i would ask some of you guys for help the problem is: Write separate programs to do the following: 1) Convert …

Member Avatar for mrnutty
0
247
Member Avatar for jrp370

ok so i really dont understand this whole recursive stuff and i need some help on a simple program. the problem is to write and test a recursive function max to find the largest number in a list. here is a non recursive function that ive made, [code] def Max(li): …

Member Avatar for Gribouillis
0
2K
Member Avatar for amari ♥

hi guys! please help me understand anything about recursion and iteration ways of coding. :) (maybe some overview, details or something) thank u. we haven't had any further discussion about this. ;p but our teacher gave an exercise that goes like this: make a program that gets the summation of …

Member Avatar for saad749
0
220
Member Avatar for bkoper16

I need help with a program that is supposed to take data on football players from a txt file and place them in a binary search tree then use case statements to t osearch the tree inorder, preorder and postorder recursively here's what i got so far [CODE] /* Bradley …

Member Avatar for Narue
0
184
Member Avatar for Binika

I would really need some help :( Write a recursive method, as a parameter to accept the folder name (absolute or relative to the current folder) that prints lists of all the files and all folders in the folder, which is given in parameter, and displays all folders in all …

Member Avatar for TrustyTony
0
214
Member Avatar for jishent

[CODE]import java.io.*;public class Ex9a{ public void rollBack(BufferedReader in) throws IOException{ String line=""; if((line=in.readLine())!=null){ rollBack(in); } if(line!=null&&!"".equals(line)){ System.out.println(line); } } public static void main(String[] args) throws FileNotFoundException{ PrintStream out; Ex9a t=new Ex9a(); out = new PrintStream(new FileOutputStream("outfile.txt")); out.println(ioe); out.close( ); String fileName="infile.txt"; try{ BufferedReader in=new BufferedReader(new FileReader(fileName)); t.rollBack(in); }catch(IOException ioe){ System.out.println(ioe); …

Member Avatar for jon.kiparsky
0
379
Member Avatar for Rez11

Palindrome detector. Palindrome is any word/sentence/phrase that reads the same foreword and back. I'm in the middle of creating a program that accepts a sentence, phrase, or word. Then checks to see if it's a palindrome, I'm just having trouble on what to pass to my function. The function must …

Member Avatar for Rez11
0
126
Member Avatar for sirko

I need to calculate the value of sin(sin...(sin(x))) for n times (n and the value of sin are input from the keyboard). That's is what I've came up with. #include "stdafx.h" #include <iostream> #include <math.h> using namespace std; double multipleSin(int n, double x); using namespace std; int _tmain(int argc, _TCHAR* …

Member Avatar for Bench
0
163
Member Avatar for BOAH365

Hello, I'm very new at C++ and I have to write a code that uses a recursive function to reverse some characters within a boundary, so lets say I have A[1] == ‘A’ A[2] == ‘B’ A[3] == ‘C’ A[4] == ‘D’ A[5] == ‘E’ and I put in a …

Member Avatar for BOAH365
0
183
Member Avatar for TrustyTony

Based on thread [url]http://www.daniweb.com/forums/thread323401.html[/url], I did this recursive version for comparision. Thanks for posters of the thread!

Member Avatar for TrustyTony
0
1K
Member Avatar for BboyRodimus

I have this recursive method that counts the amount of negative numbers that lie in the array called "NumArray" [CODE]public static int countNegative(double[] NumArray, int startIndex, int endIndex) { if (startIndex == endIndex) { if (NumArray[startIndex] < 0) { return 1; } else return 0; } else if (NumArray[endIndex] < …

Member Avatar for apines
0
1K
Member Avatar for CLina

Hello everybody! I have to Questions to ask please: 1) How can I find the maximum value in a single linked-list recursively? this is what I tried to do: int findMax(int key){ Node max=head; while (max != null){ if (max < max.getKey()) return(max.getNext()); } } it ends up to an …

Member Avatar for CLina
0
5K
Member Avatar for ottilie

Okay, I have this problem to do and I have no idea how to do it. Refer to the method result: [CODE]public int result (int n) { if (n == 1) return 2; else return 2 * result(n-1); }[/CODE] If n > 0, how many times will result be called …

Member Avatar for apines
0
128
Member Avatar for Awesomeness

I have a tree, and I want to find the depth of it. For example for this tree: [CODE]0 root / \ 1 5 1 / \ 2 1 3 | 3 2[/CODE] It should give a depth of 3. [CODE] public int getDepth() { int maxDepth = 0; if(this.hasChildren()) …

Member Avatar for Awesomeness
0
110
Member Avatar for peterwalter

I have to create a class called Polynomials and other called PolynomialTerm. The latter one to copy, add and multiply PolynomialTerm (exponents, coefficients). I also have to do the same for the Polynomial(which is an arrayList of PolynomialTerms). I am having problems adding the two polynomials.I need to do this …

Member Avatar for dierobe
0
404
Member Avatar for flyingcurry

The program like the title says is supposed to return the largest integer value in an user-inputted integer array, using binary recursion. And in the case of an empty array, return Integer.MIN_VALUE. I am kind of stuck on the logic of this binary recursive algorithm. I know there is errors …

Member Avatar for Taywin
0
178

The End.