250 Topics

Member Avatar for
Member Avatar for dendenny01

I am trying to implement Connect 4 game using Min-Max as utility to find best possible move.<br><br> The game is played on a 6x7 grid, with six rows and seven columns. . The two players take turns placing pieces on the board: the red player can only place red pieces, …

Member Avatar for rproffitt
0
449
Member Avatar for abrogard

You know the Pareto Principle? The 80/20 rule? That 80% of the work gets done by 20% of the people? Or 80% of the money belongs to 20% of the people? And so on? Well it is 'recursive' inasmuch as it can be applied again to the 20% first recognised. …

Member Avatar for JamesCherrill
1
510
Member Avatar for Reverend Jim

This code generates an ascii maze of up to size 30x30. If you try to generate a larger maze then you will likely run out of stack space. There is no way to increase the size of the stack in vbscript. Each cell in the maze is represented by a …

Member Avatar for Reverend Jim
0
594
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
394
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
384
Member Avatar for Sherwin_4

Below is my code: #include <stdio.h> #include <stdlib.h> #include <string.h> #include <iostream> using namespace std; ///////////////////////////////////////////////////////////////////////// /* // struct Edge // Represent one edge in the graph. Fields contain // two vertex numbers and a weight. */ struct Edge { int vertex_1, vertex_2, weight; }; //////////////////////////////////////////////////////////////////////// /* // struct Graph …

Member Avatar for Seif_2
0
376
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
355
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
780
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
486
Member Avatar for Gà_1

Hi every one, I had implemented Karatsuba algorithm in C++, but I have been stuck for 2 days. First problem is the function give incorrect answer, second problem is it oftens crash when run (runtime error). I try to debug but cannot understand how it's not work. I hope someone …

0
226
Member Avatar for theoryforlife

Hello, I've been working at this code from a couple angles, I've had two people I've known to help me, but even with their help it hasn't worked. The question I have relates to CodeLab: Write the definition of a function named printStarBucks that receives a non-negative integer n and …

Member Avatar for Lukas_1
0
2K
Member Avatar for noobjavacoder

OK, so i do have a perfectly good working code but im trying a different way and its bugging me why its not working. any help would be much appreciated. the program suppose to list all the available directories and then ask the user which directory he's searching for, takes …

Member Avatar for Taywin
0
238
Member Avatar for noobjavacoder

First question, is there any difference between binary search and recursive binary search??? I looked through google and everything but couldnt find any useful info. I did find irritative and recursive but that was it. and second question: Given a desired search value of 98 and an array with the …

Member Avatar for invisal
0
1K
Member Avatar for BustACode
Member Avatar for vegaseat
Member Avatar for vegaseat
4
679
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
617
Member Avatar for DS9596
Member Avatar for David W
0
386
Member Avatar for DS9596

How do I write a program to compute run-time of a recursive and non-recursive functions to find the 43rd Fibonacci number?

Member Avatar for Schol-R-LEA
0
278
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
324
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
217
Member Avatar for Schol-R-LEA

One of the more common functions in any language is conversion of an integer to a string. This implementation, which demonstrates not only the common function activation record format but also a simple recursive function, was written in response to a recent question in which the OP posted an incomplete …

Member Avatar for Kiệt
0
7K
Member Avatar for mike_2000_17

Hi all, I was just playing around with some ideas about optimizing a core piece of my library: the run-time type identification system (RTTI). What does that have to do with compile-time string concatenation? Well, the whole point of the RTTI is to provide information on the type of objects, …

Member Avatar for mike_2000_17
6
11K
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 TrustyTony

I [saw interesting problem](http://www.daniweb.com/software-development/legacy-languages/threads/478323/prolog) of generating spiral of numbers and realized I could reuse [my code for rotation](http://www.daniweb.com/software-development/python/code/371536/rotate-sequences-left-or-right) I posted earlier.

3
773
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 Szabi Zsoldos

Raffle function to generate unique numbers for each player, related to the same table with a recursive aproach. I had to do a simple raffle system for a contest that I was working on and tried many things and the most simple and the most effective one to generate unique …

Member Avatar for diafol
0
888
Member Avatar for ubhart

Hi, I am making program that finds solution how to put 12 knights(horses) to chess board that every square is dominated or engaged by other knight. Look at my code: #include <stdio.h> #include <stdlib.h> #include <stdbool.h> //(*******************************************************************************) void addNulls(char L[][9], int N[], int M[]) { int i,j,g; for (i=1 ; …

Member Avatar for ubhart
0
265
Member Avatar for ubhart

Hi I have to write program that finds a solution how to put 12 knights to a 8x8 chess board that every square would be dominated by one of the 12 knights. Do you have any suggestions from where I can start?

Member Avatar for ubhart
0
385
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

The End.