250 Topics

Member Avatar for
Member Avatar for TrustyTony

Here slightly edited code from one of my earliest posts to DaniWeb. Limitted by recursion limit of Python as it uses recursion, but interesting for me.

Member Avatar for TrustyTony
0
1K
Member Avatar for Gsterminator

Hey everyone, I am making a nqueen program that’ll read me an array of the position of the queen. I developed to different methods to do this. One is the recursion way and the other is the iteration method . My problem lies in the recursion. I am trying to …

Member Avatar for Gsterminator
0
235
Member Avatar for nexocentric

I'm having a small problem with a variable in one of my PHP scripts. The variable is `$isSubMenu`. It gets set using a function that runs recursively called createNavigationMenu. However, even though I have set it, the interpreter keeps telling me that the variable is undefined. I really don't know …

Member Avatar for nexocentric
0
563
Member Avatar for SpartanIE

I'm trying to design a function that accepts a list of numbers as an argument. I can get the program working when i put a list into the programme but I can't figure out how to allow a user to enter a series. What i've got so far is below. …

Member Avatar for TrustyTony
0
2K
Member Avatar for LDJ95

Hi all, I apologise in advance if this is too simple, but I've been searching around for a good hour or two now, and I can't quite get my head around this. Basically, I'm looking to teach myself Python (3), and one of the things I'm trying to do is …

Member Avatar for LDJ95
0
846
Member Avatar for FelineHazard

Hi all, I encountered some weird act from the return(); function. I'm doing some book exercise in recursions: write a recursive function that makes a summation 1 + 1/2 + 1/3 + 1/4 + ... + 1/n. Rather basic. So I wrote this: float summation(int n) { if (n == …

Member Avatar for FelineHazard
0
189
Member Avatar for danielsikes

Hi, I am trying to copy a directory from one spot on my server to another spot on my server. I have copied the directory successfully, but suppose I delete a file in the "parent" directory. I want the "child" directory to be exactly the same as the parent directory. …

Member Avatar for pritaeas
0
233
Member Avatar for JamesGreen

I am working on a recursive flood-fill function with 4-connected neighbours as part of a drawing application program. However, my attempts keep resulting in the program crashing. I am coding in C, however I will just post pseudo-code of my algorithm. I am hoping somebody can help me see what …

Member Avatar for Banfa
0
160
Member Avatar for maxwellp

I have written the following code to return True if the list has any repeating elements and False ow [CODE]def has_repeats(L,newlist = None): if newlist == None: newlist = [] if len(L) == 0: return False if L[0] in newlist: return True else: newlist.append(L[0]) has_repeats(L[1:],newlist)[/CODE] It is not returning True …

Member Avatar for TrustyTony
0
160
Member Avatar for starkles

Hello everyone, I have been working on a python script to help assign university students to workplace placements. The problem is that for a given group of students there are only a limited amount of places and each placement location can only caters for a few students. The ideal solution …

Member Avatar for TrustyTony
0
206
Member Avatar for Hypnos_16

[I]This exercise will explore the queue and stack data structure implemented with linked lists. The Koch snowflake can be implemented without recursion by using a queue or a stack. Assume that L is either a queue or a stack, L.add( seg ) adds a segment, and L.remove() removes the segment. …

0
106
Member Avatar for MrHardRock

Hey guys, I have the assignment of writing the Towers of Hanoi program then testing it. I already got help measuring the time of the program, but that is not what my professor wanted he wanted to count the iterations. I can't get it down, my program will run but …

Member Avatar for MrHardRock
0
2K
Member Avatar for jayadan

i dont know what mistake i have done here i could run the prog but i am not getting the o/p so guys pls help me and this is the coding if any corrections is need pls let me know and if possible change and send me the correct prog …

Member Avatar for stultuske
0
274
Member Avatar for rfrapp

Hello, I need to demonstrate the binary search using recursion, and I've run into a little problem. In my example, if "key" was 1, 2, 3, or 6, then it would return true. Anything else would give me an error. Why is that? Here's my code: [CODE] // binary search.cpp …

Member Avatar for rfrapp
0
253
Member Avatar for MrHardRock

Hey I have an assignment to get a number from the user and print it as a string with commas in the correct space. For example if the number is 13904 it should read 13,904 or 1005 should read 1,005. I have to do this recursively. Working on my pseudo-code …

Member Avatar for dantinkakkar
0
2K
Member Avatar for MrHardRock

Hey everyone, I recently had the assignment to write a recursive program to calculate greatest common denominator. I barely understood recursion when our instructor explained it to us. I understood how it works and calling on itself I am just bad at implementing it. I think I almost got my …

Member Avatar for MrHardRock
0
287
Member Avatar for rayden150

I am trying to make a recursive program that prints out the numbers from 1-100 without using any iterations such as loops, but every-time it just keeps printing out 5050..? [CODE] #include<stdio.h> #include<stdlib.h> int counter(int num); int sum=0; int main(){ int result, num=100; result = counter(num); printf("%d", result); system("PAUSE"); return …

Member Avatar for siaswar
0
293
Member Avatar for chaoz014

So this is my second project in C++, but I'm having some trouble understanding Recursive functions. We are supposed to write a program that has a recursive function. And the program should ask the user for a number. And then display the number of even digits that the number had. …

Member Avatar for Fortran IV
0
437
Member Avatar for pwolf
Member Avatar for TrustyTony
0
211
Member Avatar for jkembo

I am stuck, I know how binary tree works, but I don't have any clue how to add data recursively in a binary tree. The user needs to enter a formula with logical operators. If the user presses to a button e.g NOT(unary operator), then it should display at follow …

Member Avatar for jkembo
0
281
Member Avatar for dippatel

hi im told to make a program where the user enters a large number like 13195 and the prgrams gives it the highest prime factor, which i 29. now i have to do this using recursion in basic c, without using loops of any kind, so noo for, while etc. …

Member Avatar for VernonDozier
0
7K
Member Avatar for jkembo

Good morning everyone, I have a small problem here. I tried to code a piece of program which allows users to construct logic formula. (E.g A V NOT(B)) When the button NOT (unary connective) is pressed 2 times then this happens: [COLOR="Green"]NOT(NOT())[/COLOR], using a static recursive method called Rec returning …

0
144
Member Avatar for JohnPool

Can somebody give me advice on how to create a recursive version of GetEnumerator()? The well-known Towers of Hanoi problem (see e.g. [url]http://en.wikipedia.org/wiki/Tower_of_Hanoi[/url]) may serve as an example that is comparable to the actual problem I have. A simple algorithm to show all moves for a stacjk of disks of …

Member Avatar for darkagn
0
254
Member Avatar for Kyle Willett

I'm doing a program that is supposed to reverse a string entered my the user using a recursive function, I almost have it solved except for one little elusive bug that I can not understand. [CODE] //****************************************************************************** //Programer: Kyle Willett //Course: CS-1513 //Program: 3 exercise 7 page 933. //Purpose: Reverse …

Member Avatar for Kyle Willett
0
209
Member Avatar for RM@Bowdoin

I'm trying to find degrees of separation between any two actors in a movie database. I succeed when I reach my base case, which is 1 degree of separation (i.e. actor is in same movie as another actor) but I use recursion to find all other degrees of separation, and …

Member Avatar for Gribouillis
0
2K
Member Avatar for iamthesgt

This is another homework problem. I thought it was easier, and I wouldn't need help, but I keep getting a segmentation fault when running the program. The assignment is to use a recursive function to output the amount of candybars we can buy with a user-inputted amount of money. Each …

Member Avatar for markshah2
0
613
Member Avatar for charleneok

Anyone know how to do this question? Use recursion to implement the following recurrence relation f(x): f(x)=1 where =1 f(x) = f((x+1)/2) +1 where x is odd f(x) = f(x/2) +1 where x is even This is what i did: [CODE]#include<stdio.h> int func (int x) int main() { int x; …

Member Avatar for selina12
0
201
Member Avatar for eRayven38

Hey Guys, I am really trying to get into List-Implementation. Everything I wrote works fine except the "delete Element at Position" funktion. With the iterative Implementation there is no problem, everything works, but I want to do a recursive Version. This is the Task: Invent an algorithm which becomes a …

Member Avatar for deepu.sri24
0
1K
Member Avatar for Stazloz

I am writing a recursive function to return an integer after converting a string. I am very close. This was already quite the brain teaser, and recursion is not my cup of tea. Perhaps somebody can help with this small little problem I am having. The last thing I need …

Member Avatar for Stazloz
0
3K
Member Avatar for _electricblue

#include <iostream> #include <fstream> #include <cstdlib> using namespace std; const int numRows = 22; // Number of rows in the board const int numColumns = 80; // Number of columns in the board int row; int column; char Drawing[numRows][numColumns]; // environment representing all the cells and their state. char point[6]; …

Member Avatar for mazzica1
0
873

The End.