250 Topics

Member Avatar for
Member Avatar for vmirz

My assignment is as follows... Create a program called part4.cpp containing a recursive function that accepts a pointer to a null-terminated string as its argument, and prints the string in reverse order. Demonstrate the function by calling it from the main function with a string that has been provided by …

Member Avatar for chiwawa10
0
103
Member Avatar for mibushk

Hello, I would need your help, I have a Perl code that makes a folder structure, it reads a txt and creates the folders Now I have an issue I have to go through this folder structure and insert a file delete_me txt is yhe lowest level, and I have …

Member Avatar for d5e5
0
394
Member Avatar for Griff0527

Ok, I have read several other questions basically asking the same thing, but I know this code can work instead of using other peoples work. Yes, i'm stubborn. I have written a function to be called from my main program and i keep getting an error that I cannot figure …

Member Avatar for jephthah
0
745
Member Avatar for stryker4526

So I have a problem... according to the specification given by my lab TA, we must [QUOTE]"write a Microsoft Visual Studio console application that will calculate the following four operations over the elements of a two dimensional array (matrix) of integers: 1. Sum 2. Average 3. Max 4. Min All …

Member Avatar for Wizardsr66
0
4K
Member Avatar for why1991

For my program I am working with simple graphics and need to display a straight row of squares from left to right decreasing in size. I also have to program this recursively so that it makes the squares following the first one by itself. My problem right now is that …

Member Avatar for darkagn
0
115
Member Avatar for why1991

I am trying to make a row of decreasing squares with a recursive method, but none of the squares comes up besides the first one. Any ideas where my code is going wrong? [CODE] import java.awt.*; import java.awt.event.*; import java.util.Random; public class Lab19ast { public static void main(String args[]) { …

0
82
Member Avatar for trantran

This is likely a stupid question, but I can't figured out by myself how to pass a pointer to a member function of a templatised class in its own template parameters. More clearly: I would like to have this to work out: [code]template <typename T, T test::* PtrToMember> class test{ …

Member Avatar for trantran
1
555
Member Avatar for peterwalter

Please help me!1 this is what I have so far I am stuck in the plus and both times in the Polynomial class [CODE]public class PolynomialTerm { private int exponent = 0; private int coefficient = 0; public PolynomialTerm(int exp, int coeff) { int[] term = new int [2]; if …

Member Avatar for javaAddict
-1
99
Member Avatar for Ecliptical210

Hey guys, I'm creating a Maze class along with a client class where it allows the user to input a direction (U/L/R/D), and then the validity of the move will be returned as well as the new position of the maze. So far, I've got this, but when I try …

Member Avatar for rue64ja
0
231
Member Avatar for Tango2010

Hi, I have been experiment with Recursion / Trasversal through directories recently but seem to have run into a few unexplainable errors. Attached is my source code which is a function (which has the path (input user directory) passed into it). What im hoping this function will do is detect …

Member Avatar for Salem
0
614
Member Avatar for corby

ok so if T(1) = 3 and T(n) = T(n-1) +2n -3, n > 1 how do i solve for T(n) and how do i then prove it with the verification, inductive hypothesis, and inductive step? same thing for T(1) = 1 T(n) = T(n/2) + bn(logn) where b is …

0
70
Member Avatar for DuffManLight

Trying to learn recursion. Problem asks to use recursion on non-negative number to insert commas. Ex: 20131 as 20,131. My program adds in an extra comma at end. Any help in pushing me in the correct direction to fix this would be appreciated. Tried to use a 'count' to determine …

Member Avatar for WaltP
0
1K
Member Avatar for corby

Here some psuedocode for an algorithm: [CODE] function Fact(n) if n <=1 then return(1) else return (n * Fact(n-1)! end-if end-fact[/CODE] Now how do i find the recurrence equation for the program? Any help or hint would be appreciated!

Member Avatar for galagatron
0
87
Member Avatar for holocron

Hello all, Here I intend to reverse a line of text ending in a newline, but only the individual words will be reversed, not every character. For example, "This is just a test." would output ".test a just is This". The code as stands prints a space for every character …

Member Avatar for WaltP
1
679
Member Avatar for polygon

Dear Folks, I am trying to use python-idiom to reverse a list of lists so that, for example, a = [[1, 2], ['apple', 'orange']] becomes b = [['orange', 'apple'], [2, 1]] My code for this at present is: [CODE] import copy a = [[1, 2], ["apple", "orange"]] if type(a) is …

Member Avatar for Gribouillis
0
2K
Member Avatar for Dhanika

Greetings everyone! I hope to learn and become better in programming. But honestly, my heart fails me everytime I face a new assignment. This one is just another heartache. Thing is, the question wants me to print out n-bit strings in lexicographical order ( meaning increasing order ). And I …

Member Avatar for Dhanika
0
2K
Member Avatar for hannaxbear

The function I am trying to write is supposed to be recursive and does the following: Return the number of ways that all n2 elements of a2 appear in the n1 element array a1 in the same order (though not necessarily consecutively). The empty sequence appears in a sequence of …

Member Avatar for hannaxbear
0
147
Member Avatar for rwill357

This is what I have so far. This program should contain a recursive function that will compute the binomial coefficient according to the definition if k=0 or k=n [CODE]#include <iostream> #include <algorithm> using namespace std ; int C(int n,int k) { if (k < 0 || k > n ) …

Member Avatar for rwill357
0
167
Member Avatar for chiko987

Hello, i have a function that starts searching for all files that match the given file name and Recursively traverses itself into sub directories and does the same thing and when a file is found i should output its path starting from the first directory that was given to the …

Member Avatar for death_oclock
0
136
Member Avatar for johni12

Hey, I'm sorry for being such a python newb, but thanks for helping me out with the last one! Hopefully you guys will help a newb out again :) This time, I need to use a recursive function to basically do the same thing that the .replace function for strings …

Member Avatar for johni12
0
135
Member Avatar for johni12

Hi, I am a newbie here and a python newbie as well :) I am having trouble implementing a program in which you must use only recursive functions and no built-in python functions other than the len function in order to determine if there are duplicates of an item in …

Member Avatar for johni12
0
240
Member Avatar for ddanbe

Whenever you hear the word recursion, factorials or Towers of Hanoi are never far away. Well here they get mentioned, because we are not going to talk about these guys at all! Iteration and recursion are in fact quite similar: they both loop until a certain condition is met. As …

2
3K
Member Avatar for codewalkz

i must be able to extract the results of this query and use it as another value for "Parent" in the succeeding "THE SAME QUERY". Right here, the value of parent in WHERE clause is "1". Now, I want to create the same query but the value of the parent …

Member Avatar for codewalkz
0
241
Member Avatar for beatenbob

Hi all. Just a simple question but I SERIOUSLY need some help from you guys for my programming assignment. The assignment given was water jug problem. Now my question is, does C allow for the creation of dynamic array during a recursion? Suppose I have another function, which returns a …

Member Avatar for gerard4143
1
401
Member Avatar for Farfie

Hello. I need to write a static recursive method that returns the frequency of occurrence a particular digit d in an integer n. For example, if passed (1342457,4) it should return 2, whereas when passed (1342457,6) it should return 0. I won't put my code in as it is arbitrary, …

Member Avatar for stevelg
0
156
Member Avatar for denizen08

[CODE]#include <cmath> long double NR(long double sample) { return (abs(f(sample)))<=1e-10 ? sample: NR( (sample - f(sample)/fp(sample))); } long double f(long double sample) { return 2.5*exp(-sample)-3*sin(sample); } long double fp(long double sample) { return -2.5*exp(-sample)-3*cos(sample); }[/CODE] I'm trying to write code for a Newton-Raphson algorithm. I have it in recursive form …

Member Avatar for denizen08
0
179
Member Avatar for aman rathi

helllo last day i did program related to recursion that is factorial of numbers i red lot of books in my library but i found only this program only in every book. i also thought lot on recursion but i did not find any more program please can anybody tell …

Member Avatar for Cmad
0
115
Member Avatar for codewalkz

mysql_connect("localhost", "root", "") or die(mysql_error()); mysql_select_db("test") or die(mysql_error()); $root = 1; function display_tree($root) { // retrieve the left and right value of the $root node $result = mysql_query('SELECT lft, rgt FROM tree '. 'WHERE name="'.$root.'";'); $row = mysql_fetch_array($result); // start with an empty $right stack $right = array(); // now, …

Member Avatar for sam023
-1
166
Member Avatar for gundalav

I tried to print all the possible combination of members of several vectors. Why the function below doesn't return the string as I expected? [CODE=c] #include <iostream> #include <vector> #include <fstream> #include <sstream> using namespace std; string EnumAll(const vector<vector<string> > &allVecs, size_t vecIndex, string strSoFar) { string ResultString; if (vecIndex …

Member Avatar for Sodabread
0
199
Member Avatar for ChaseRLewis

Newbie Here Edit: This is not homework, I am a chemical engineering student and a math minor. I'm doing programming on the side to help me automate certain calculations later in my career. Also always had a healthy interest in programming. I just read the not doing homework for people …

Member Avatar for vegaseat
0
208

The End.