Hi, I'm working on a project for my A level. It involves finding the maximum flow of a network, and I'm using javascript.
I have a 2D array, with values in the array representing a distance between the two points. An example of the array:
0 2 2 0
0 0 1 2
0 0 0 2
0 0 0 0
I think I need to use a recursive technique to find a path; belo...
Hi everyone,
I looked through the related questions for a similar question but I wasn't seeing quite what I need, pardon if this has already been answered already. In my database I have a list of records that I want represented to the user as files inside of a folder structure. So for each record I have a VARCHAR column called "FolderS...
I'm trying to remove all of the leaves. I know that leaves have no children, this is what I have so far.
public void removeLeaves(BinaryTree n){
if (n.left == null && n.right == null){
n = null;
}
if (n.left != null)
removeLeaves(n.left);
if (n.right != null)
removeLeaves(n.right);
}
...
Hi,
So I got this situation which sucks. I have an XML like this
<table border="1" cols="200 100pt 200">
<tr>
<td>isbn</td>
<td>title</td>
<td>price</td>
</tr>
<tr>
<td />
<td />
<td>
<span type="champsimple" id="9b297fb5-d12b-46b1-8899-487a2df0104e" categorieid="a1c70692-0427-425b-983c-1a08b658536...
Hey all -
I have to design and implement a Fortran routine to determine the size of clusters on a square lattice, and it seemed extremely convenient to code the subroutine recursively. However, whenever my lattice size grows beyond a certain value (around 200/side), the subroutine consistently segfaults. Here's my cluster-detection rout...
I'm using sed for windows to do search and replace on some javascript files, and I was wondering if using some other utility I could make it work recursively.
...
Will incrementing the instance variables of an object ever lead to a stack overflow error?
For example:
This method (java) will cause a stack overflow error:
class StackOverflow {
public static void StackOverflow (int x)
{
System.out.println (x) ;
StackOverflow(x+1) ;
}
public static void main (...
I'm implementing the Euclidian algorithm for finding the GCD (Greatest Common Divisor) of two integers.
Two sample implementations are given: Recursive and Iterative.
http://en.wikipedia.org/wiki/Euclidean_algorithm#Implementations
My Question:
In school I remember my professors talking about recursive functions like they were all th...
My xml document reflects an Object. as referential Recursion is possible in objects and arrays. I need to reflect that in reproduced XML Structure too.
Currently I am using Unique IDs to identify each node separately and a node like <recursion refer="IDREF"> and specifying the ID of the referenced Element.
But in This way I need My Own C...
Hi guys, I'm trying to write a jQuery function to let users upload many files at once. Here's the function I thought to give the user some feedback about the upload process progress.
function uploadFiles(numbersOfFiles, start) {
$("#info").html(start + " files uploaded");
$.post('upload.php', {
start: start
}, function (d...
Hi All,
I am trying to to use reflection to achieve the following:
I need a method where i pass in an object and this method will recursively instantiate the object with child objects and set the properties with default values. I need the entire object instantiated going as many levels as needed.
this method needs to be able to handle...
So why is this not working? I'm creating a regex that will match a formula (which is then part of a larger standard description). But I'm stuck here, as it doesn't appear to want to match embedded formulas within a formula.
stat = /(Stat3|Stat2|Stat1)/
number_sym = /[0-9]*/
formula_sym = /((target's )?#{stat}|#{number_sym}|N#{n...
Create a recursive function for the binary search. This function accepts a sorted array and a give item being search for and returns the index of the item if this give item in the array or returns -1 if this give item is not in the array. Moreover, write a test program to test your function.
Sorry for the bad english but my teacher c...
Can anyone please explain a recursive function to me in PHP (without using Fibonacci) in layman language and using examples? i was looking at an example but the Fibonacci totally lost me!
Thank you in advance ;-)
Also how often do you use them in web development?
...
Guys,
I'm new to java and multithreading..... and I have a following problem:
I have two classes running in two different threads. Class A and Class B.
Class A has the method "onNewEvent()". Once that method is invoked, it will ask class B to do some work. As soon as B finishes the work it invokes onJobDone() method of the class A.
N...
I know that recursion is sometimes a lot cleaner than looping, and I'm not asking anything about when I should use recursion over iteration, I know there are lots of questions about that already.
What I'm asking is, is recursion ever faster than a loop? To me it seems like, you would always be able to refine a loop and get it to perform...
I just made an interesting mistake in my code:
Dim endColumn As Integer = startColumn + endColumn - 1
The code was actually supposed to be:
Dim endColumn As Integer = startColumn + numColumns - 1
The interesting thing is, I would think that this code should be recursive and loop indefinitely, as the initialization of endColumn sort...
I'm creating a program that checks if a word or phrase is a palindrome. I have the actual "palindrome tester" figured out. What I'm stuck with is where and what to place in my code to have the console read out "Enter palindrome..." and then text. I've tried with IO but it doesnt work out right. Also, how do I create a loop to keep go...
PLease help me out here. The program is supposed to recursively find out the combination of two numbers. nCr = n!/ (r!(n-r)! ). I'm getting this error message when i compile it on GCC.
Here's what the terminal shows:
Enter two numbers:
8
4
Segmentation fault
(Program exited with code:139)
The code is given here:
#include<std...
I am trying to do work with examples on Trees as given here: http://cslibrary.stanford.edu/110/BinaryTrees.html
These examples all solve problems via recursion, I wonder if we can provide a iterative solution for each one of them, meaning, can we always be sure that a problem which can be solved by recursion will also have a iterative so...