250 Topics

Member Avatar for
Member Avatar for engy.adel90

hi i have that code and this function gives me static overflow when i run the problem and stopped to work can anyone tell me why is this happening public bool declaration_List() { // sc.token(); if (declaration_List()) { if (declaration()) return (true); } else return (false); if (declaration()) { return …

Member Avatar for Ketsuekiame
0
141
Member Avatar for marnun

> Write a recursive, bool-valued function, containsVowel, that accepts a string and returns true if the string contains a vowel. > A string contains a vowel if: > The first character of the string is a vowel, or > The rest of the string (beyond the first character) contains a …

Member Avatar for marnun
0
511
Member Avatar for codeyy

How do I write a recursive function in C++ to display a triangle of * like this using a parameter size (e.g. 4 in the following example): * ** *** **** I am able to write a recursive function to display an inverted triangle like this: **** *** ** * …

Member Avatar for Gonbe
1
3K
Member Avatar for ofir.attia.7

I have a list of sizes ( for example : 3X1 , 4X2 and so on..) i want to check if i can put all of them in one matrix. i need to do it in a recursive way. the function I need to write is a function that get …

Member Avatar for ofir.attia.7
0
316
Member Avatar for zeroliken

I bet all Computer Science related courses would learn low level or machine level languanges in due time and in our university we used the portable 80x86 assembler NASM for our Assembly code So here's my experimentation on how to use "functions" and recursion using a Fibonacci Solver as a …

0
1K
Member Avatar for acerious

Here I have some code that will run a program that generates a bunch of lowercase and uppercase letters from length 15-25 and will swap it first using an iterative swap method. It will then generate a second set of letters and will swap it this time with a recursive …

Member Avatar for acerious
0
189
Member Avatar for taylor.mitchell.353

I created a hashing method to make a=1, b=2, c=3...etc. To me it doesn't seem too efficient. Does this look efficient or is there a recursive method or smaller method to do the same thing? /** * Changes String to int * @param key: String * @return (result % arraySize): …

Member Avatar for NormR1
0
289
Member Avatar for sobias

Hi everyone, We all face dificullity in coding recursivly, maybe most of new codders and CS students. However, **my question today is related to How many number of execution been made by the recursive method.** Which I think a bit tidious. I'll be updaing this article with new questions any …

Member Avatar for doomsday1216
0
174
Member Avatar for ibthevivin

So let's take "banana", what happens when the program gets to if (ch <= 'd')? My understanding is the 'b' is < 'd' so it moves to the else. Am I wrong or right? If I'm right, then what happens at return 1 + g(s, index + 1); public class …

Member Avatar for ibthevivin
0
188
Member Avatar for oateye

I am working on a minesweeper project and everything is working fine EXCEPT for when you click on a cell and it contains a 0 (no mines around it) and it is supposed to open all the other "0" cells around it using recursion. Right now, I keep on getting …

0
288
Member Avatar for sobias

Hi guys, I'm trying to solve a problem recusrively. I'm asked to multiply two numbers with only using Addition,Subtraction and Comparison. After looking around the internet, it seems that the Algorithm I should use is Egyptian Algorithm . [Click Here](http://en.wikipedia.org/wiki/Ancient_Egyptian_multiplication) I would like some tips on how to solve this. …

Member Avatar for sobias
0
1K
Member Avatar for ibthevivin

>Write a Java program that recursively reads ten names from a file, and then outputs the total number of characters in the names, the list of names, and the list of names in reverse order. All looping must be performed recursively. > Jay Walker Erol Flintstone C. Erol Madre Billy …

Member Avatar for Taywin
0
2K
Member Avatar for prakhs

#include <stdio.h> #define MAXSIZE 100 int memo[MAXSIZE][MAXSIZE]; int aukermann(int m, int n) { if (memo[m][n] != -1) return memo[m][n]; if (m == 0) return (memo[m][n] = n + 1); else if (n == 0) return (memo[m][n] = aukermann(m - 1, 1)); else { memo[m][n-1] = aukermann(m, n-1); return (memo[m][n] = …

Member Avatar for dooma
0
174
Member Avatar for rizwan.ali.1656

HI I would like to modify the following function so that it could take any of the operators such as +,-,* or /. I want to know if its possible to do this without having to write bunch of ifs and else to define each of the operators separatly like …

Member Avatar for ravenous
0
350
Member Avatar for FUTURECompEng

Currently this method has a run time of O(N^2) and I am trying to get it to O(N). Any suggestion as to where I should start? public void removeAll(e removeNum) { node nodeToFind = this.find(removeNum); while(nodeToFind != null) { this.remove(nodeToFind); nodeToFind = this.find(removeNum); } } Thanks

Member Avatar for JamesCherrill
0
296
Member Avatar for compscihelp

Hi, I need to create a function using **recursion** to find out if two lists have the same shape. For example, if nest1 = [4, [ [3,6], [] ,7] ,[8] ] nest2 = [ [ [3] ] , 7 , [ [5 , [9 , 2] , [ [ [ …

Member Avatar for compscihelp
0
200
Member Avatar for somjit{}

**the code works perfectly, just i got something i dont understand...** i'v been trying to get a hold of recursion and sorting for about 3-4 days now, im getting some of it, but still not happy enough.. i searched for some good code for binary search and merge sort on …

Member Avatar for somjit{}
0
424
Member Avatar for prakhs

http://www.codechef.com/problems/NUKES I'm getting time limit exceeded in my code... Please some one help me out with this code. My algorithm is when A - ((N+1) ^ (p+1)) < 0 then pth chamber will have 1 particle and the new value of A in my recursive function is A - ((N+1) …

Member Avatar for L7Sqr
0
638
Member Avatar for FUTURECompEng

I am trying to create a simple AI (for four in a line). I have looked online and found a few complicated AI's but they were to complex for me. I am trying to use recursion and maxDepth to create an AI to play two moves ahead. public class AIMove …

Member Avatar for Taywin
0
261
Member Avatar for cody.reddoor

public void inOrderTraversal(TreeNode node) { if(node == null) { return; } inOrderTraversal(node.getLeft()); System.out.print(node.getKey() + " "); inOrderTraversal(node.getRight()); } I wrote this code for going through a binary search tree and printing out the items in order from low to high. it works just fine but i need to get it …

Member Avatar for Taywin
0
279
Member Avatar for Abhineet.Ayan

Hi All, I am implementing a recursive registry delete using RegOpenKeyEx, RegDeleteKey and RegEnumKey. **Problem::** Though the code works perfectly fine for Vista x86/x64 and Win 7 x86/x64 but fails on XP for some keys in HKCR **Problem Area::** HKCR\Installer\SomeKey **Error Code::** 87 (INVALID_PARAMETER) **Weird Behaviour::** Deletes the key the …

Member Avatar for Abhineet.Ayan
0
1K
Member Avatar for caswimmer2011

Hey, I am trying to use a for loop inside a recusive method, but everytime the method runs recursively, the integer in the for loop resets to zero because of the initialization. Is there anyway to keep the integer counting up, and not resetting to zero? Thanks in advanced!

Member Avatar for Taywin
0
141
Member Avatar for nitishok

I have written a program for the 8-Queens problem.It prints all possible solutions. queens() finds all the possible solutions. ok() tells whether the given column and row is safe or not. The very strange problem is: 'Count' won't increment. I have no idea why. #include<iostream.h> #include<stdlib.h> #include<conio.h> int arr[8][8]={0}; int …

Member Avatar for deceptikon
0
167
Member Avatar for grh1107

I'm Creating a class that I want to call a recursive function within it. However, the complier says i cant declare a function within a method, I was wondering how I could Recursively call that function, in the method, or how to recursively call that method, with out declaring the …

Member Avatar for mike_2000_17
0
3K
Member Avatar for 4evrmrepylrning

I have this: import re subs = [] def subcons(data): match = re.search(r'(<[a-z]{3})', data) if match: subs.append(match.group(0)) data = data.replace(match.group(0), '') subcons(data) else: print data return data, subs input = 'ABC <uvw <xyz some random data' e, f = subcons(input) print e print f The print statement in the else …

Member Avatar for TrustyTony
0
209
Member Avatar for TrustyTony

Here you see how one could use recursion together with generators for (inefficient) permutations generator. It is kind of interesting to know how one can do it recursively (of course there exist many ways). Anyway this snippet demonstrates how you can use recursive generator call to feed a for statement. …

0
431
Member Avatar for caglaruz

I've been doing some research about multilingual and recursive database design for few days. I found interesting the following article: http://www.gsdesign.ro/blog/multilanguage-database-design-approach/ and liked the 4th solution Coupled Translation Table Approach. But I'm seriously confused since I don't understand the case; I see there is only one column id on pages …

Member Avatar for pritaeas
0
227
Member Avatar for txhornsfan

I am having problems with my code. I think it is the print function, but I'm not sure. Everything compiles correctly. Just no output. Any help is appreciated. Thanks Here is what I have: #include <iostream> using namespace std; struct node* tree = NULL; struct node { int data; struct …

Member Avatar for Lucaci Andrew
0
215
Member Avatar for neoseeker191

I have looked through a few SQL hierarchy tutorials, but none of them made much sense for my application. Perhaps I am just not understanding them correctly. I'm writing a C# ASP.NET application and I would like to create a tree view hierarchy from SQL data. This is how the …

Member Avatar for Momerath
0
4K
Member Avatar for Johnathon332

at the moment I am having a problem with looping back to noun_phrase from np2. I was wondering if someone can help me loop back to nounphrase. Here is some code: noun_phrase([X|T],(det(X), NP2),Rem):- det(X), np2(T,NP2,Rem). np2([H|T],np2(adj(H),Rest),NP) :- adj(H), np2(T,Rest,Rem), noun_phrase(NP,Rem,_). I want to loop from np2 back to noun_phrase. I …

Member Avatar for TrustyTony
0
308

The End.