90 Solved Topics

Remove Filter
Member Avatar for
Member Avatar for samertaha

Hi, I have created a function that searches for a category in a category tree object and returns all the paths for it as an array of strings, please advice how I can improve it ? the result im getting now is : ["vehicles",["cars","mercedes"],["trucks","mercedes"],["motorcycles","BMW"]] i need it in one dimesional …

Member Avatar for samertaha
0
397
Member Avatar for Iamateur

Hie,I have Merge Sort Program .It's giving correct output but when checked through debugger it gives different values everytime.I also tried doing it manually but I am not getting the actual output. I will not ask now for complete program explanation. I just want to know the value over here.This …

Member Avatar for rproffitt
0
385
Member Avatar for Sherwin_4

Good evening everyone, Does any one have a reference/videos/tutorials on how to use recursion effecitely in C++? v/r

Member Avatar for Chris_38
0
356
Member Avatar for Sherwin_4

Good morning everyone, The library will be home, 0800 till 2100. I've been working on trying my loops in my hailstone sequence into recursions. It seem recursion can easrier to do, instead of creating loops. I say seem, because now I have come to halt on my progress. The halt …

Member Avatar for JamesCherrill
0
781
Member Avatar for glao

Hello , I have this code: #include <iostream> #include <cstdio> #include <cstdlib> using namespace std; void message(int numbers) { cout << "Entry to function #" << numbers << endl; if ( numbers > 0 ) { cout << "This is a recursive function." << endl; message( numbers-1 ); } cout …

Member Avatar for glao
0
488
Member Avatar for preslav_milev

Hello ! I have a task that is difficult for me to handle. The task is: Create recursive function that can be generate a string of length N (N <= 100), formed by the letters 'A', 'B' and 'C' and does not containing two identical adjacent substring. For example: enter …

Member Avatar for preslav_milev
0
618
Member Avatar for gabrielcastillo

So I am trying to remove line feed within an array but not cariage returns. Having trouble using array walk, the ltrim function is not working. I need to remove ONLY the line feed("\n") not the cariage return("\r") so using trim will not work. I tried setting the chr(10) and …

Member Avatar for gabrielcastillo
0
325
Member Avatar for ravi142

Hello, I want help for recursive in php which like structure is attachment file.. [1] **Sire (Parent)** > Sub1 ->nChild.. > Sub2 [2] **Dam (Parent)** > Sub1 ->nChild.. > Sub2 ->nChild.. Do you have some example of code so its better for me. Thank You.

Member Avatar for Taywin
0
220
Member Avatar for Adami

Hi guys, I wrote the following code: public static boolean match(int[] a , int[] pattern) { //need to use the overloaded method, in order to work with the static method. return match(a,pattern,0,0); } /** This is an overloaded method that match between a pattern to a given string (as an …

Member Avatar for Adami
0
3K
Member Avatar for stephen.teacher

hi all, this is some extra credit from class we sat around cleaning up code today this is what we came up with public boolean equals2(IntTree t2){ return equals2(this.overallRoot, t2.overallRoot); } private Boolean equals2(IntTreeNode r1, IntTreeNode r2){ if(r1 == null || r2 == null){ return r1 == null && r2 …

Member Avatar for stephen.teacher
0
298
Member Avatar for duncan55

Im trying to add odd numbers recursively from n to m but its not working . im sure its in the recursive logic on how im passing the arguments or something. public static int OddSum(int low, int up,int total) { if(low==up) { return up; }else { low+=2; return total += …

Member Avatar for jwenting
0
204
Member Avatar for Pyler

How's the result to this 7? void foo(int i){ if(i>1){foo(i/2);foo(i/2);}cout<<"#"<<endl;}

Member Avatar for vmanes
-1
221
Member Avatar for jackslv

This is just a piece of code I've found over the Internet, and I'm trying to understand why the output is 3 1 1 2 1 1 2 3. Could anyone explain using a stack representation or something else, I am really stuck on this one. #include <iostream> using namespace …

Member Avatar for jackslv
0
232
Member Avatar for MrHardRock

Hey guys I had an assignment to recursively write the Towers of Hanoi then test it. I did not have too much of an issue getting the program written But I am not sure what the book means by test the efficiency do they want the number of moves my …

Member Avatar for stultuske
0
899
Member Avatar for Labdabeta

Hello, First of all some background. My friend and I are having a bit of a competition over theoretically infinite number storage. We have agreed that the first person with a working arbitrary precision integer library with the theoretical ability to store an infinitely large number (IE: if the hard …

Member Avatar for Labdabeta
0
291
Member Avatar for Aethir

# This is an advanced guess the number game. import random # The very basis of this game. import math # Used for math.ceil import time # Used to split up long portions of text. def errorDisplay(errorCode): if errorCode == '1': print('\n\n\nError ' + errorCode + ': unlockedGameModes outside of …

Member Avatar for Aethir
0
277
Member Avatar for fatalaccidents

Hello all, I'm having trouble writing a spell checker as my recursive function isn't returning what I would like it to. It is meant to chop off the ends of words likes "baker" to bake and check against a predined dictionary. I used recursion for words like "baker's". I have …

Member Avatar for bguild
0
175
Member Avatar for amvx86

Hello all, I am trying to get a bunch of sub-keys and values from the registry in vb 2010 and i remember in vb6 this was quite easy. Can anyone share code to help? Or a link where I can go? I've been searching for nearly 8 hours on line …

Member Avatar for amvx86
0
2K
Member Avatar for newGains

i am trying to use recursion to find the occurence of a specific character in an array of characters public class CharacterCounter { public static void main(String [] args) { char test[] = {'a', 'b', 'a', 'c', 'd', 'a', 'e', 'a', 'f', 'g', 'h', 'a', 'i', 'a'}; char searchChar = …

Member Avatar for newGains
0
256
Member Avatar for HankReardon

Hello, Would someone be willing to take a look at this segment of code? I am trying to figure out how this segment of code operates. I can see how the program can evaluate a simple prefix statement like + 7 6. I cannot see how the program can solve …

Member Avatar for HankReardon
0
252
Member Avatar for cerealBoxx

Hi guys, I have this code - I am trying to find if a number is present in a given array using recursion. The thing is, I get the error "not all code paths return a value". I don't know how to fix this. Please advise. using System; namespace checkArrayForValue …

Member Avatar for aaa_78600
0
543
Member Avatar for somjit{}

this code gives the correct result upto size 6 (i'v run this a few times, and 6 seems to be the boundary), although the intermediate steps are all insane! then onwards, from size 7, it returns minimum value 0 /*minimum of an array using recursion*/ #include<stdio.h> #include<stdlib.h> int findMin(int* arr,int …

Member Avatar for somjit{}
0
361
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 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 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 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 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

The End.