Hey there,
Does anyone know the logic behind creating a recursive function to generate all combinations of capitals in a given word? I'm trying to do this in Java... For exmaple, give it the word "ben" and it outputs:
Ben
bEn
beN
BEn
BeN
bEN
BEN
But for any length word... any help appreciated!
Thanks,
Ben
...
int i = 0;
int min = x[i];
while ( i < n ){
if ( x[i] < min ){
min = x[i];
}
i++;
}
return min;
I've written the iterative form to find the min number of an array. But I'd like to write a function that with recursion. Please help!
...
I've written the code below to calculate the length of a word at the beginning of a string with recursion. I've thought of a case in which my code would not work " #@*hello " what do I need to modify the code to resolve this problem (the correct answer is 5)? Thanks
int startWordLenRec(char s[]) {
int length;
if (isLe...
I have a class (Node) which has a property of SubNodes which is a List of the Node class
I have a list of Nodes (of which each Node may or may not have a list of SubNodes within itself) I need to be able to find a Node within the Node list/subNodes.
I have tried to do Find on the list but that will only search the Node classes within t...
I'm having some trouble with a recursive relationship in core data. I've got a managed object called a "SearchCategory", and that category can have "Categories" and it can also have a "Category." In the managed object modeler, I've got two relationships set up on the SearchCategory entity, and both point back to the SearchCategory enti...
Hi guys,
I've got a problem with my VBA (you guessed it).
I took code from this post:
vbaexpress.com/kb/getarticle.php?kb_id=405
and added in:
wilmott.com/messageview.cfm?catid=10&threadid=40372
Basically, first code would output to a worksheet, but as I theoretically could breach the 65k rows limit, I'd like to output to a csv inste...
Hello everybody,
I have a list of items in a page that must be hidden in sequence, but just after the previous item has been totally hidden.
I made the following code, where I create a big string inserting the callbacks inside the previous callbacks and later use eval to execute the effects, but despite the code is working fine as expe...
I need to wait for an ajax response inside a for loop. If I could I'd simply make a synchronous call instead of asynchronous, but I don't have that level of control: I'm using somebody else's API which in turn calls eBay's Javascript API.
Below are my two functions, actually methods on the same closure/object, with categoryStack and ca...
I have created a recursive template for getting the first n number of items from my XML.
It uses an index(counter) just like how I would in a for loop. Now how can I get a node from my XML using the index?
I have tried [position()=$index] but it had weird behaviour when trying to get deeper nodes in the XML hierarchy.
If I have XML su...
This is a sample of my XML, it can possibly have thousands of rows of items in a range of categories.
<store>
<products type="computer">
<item desc="text" amount="99"></c>
<item desc="text" amount="69.95"></c>
<item desc="text" amount="4.50"></c>
<item desc="text" amount="10"></c>
<item desc="text" amount="9.99"><...
What is the simplest way of doing a recursive self-join in SQL Server? I have a table like this:
PersonID | Initials | ParentID
1 CJ NULL
2 EB 1
3 MB 1
4 SW 2
5 YT NULL
6 IS 5
And I want to be able to get the records only related to a...
I have the following table in a SQL Server 2008 database:
Id Name ParentFolder
-- ---- ------------
1 Europe NULL
2 Asia NULL
3 Germany 1
4 UK 1
5 China 2
6 India 2
7 Scotland 4
ParentFolder is a FK to Id in the same table. I would like to create a view that results in somet...
Hi! I am in the process of refreshing my XST knowledge, and have decided to have a go at making an XSLT 1.0 stylesheet that convert the XMLHelp files from the C# compiler into a better formatted form.
There are a number of issues to get around, but currently I am simply trying to parse those annoying member name attributes, and creat...
Hello, I'm looking for an explanation for how the recursive version of pascal's triangle works
The following is the recursive return line for pascal's triangle.
int get_pascal(const int row_no,const int col_no)
{
if (row_no == 0)
{
return 1;
}
else if (row_no == 1)
{
return 1;
}
else if (col...
private function find_children ($parent_id, $children, &$result)
{
foreach ($children as $c)
{
if ($c->parent_comment_id == $parent_id)
{
$result[] = $c;
$this->find_children($c->id, $children, $result);
}
}
r...
Hi guys,
I'm looking to write a recursive php function that would call a function to generate nested HTML blocks ( not necessarily only DIVs ). So for example, for the following array:
$a = array(
'b' => 'b value',
'c' => 'c value',
'd' => array(
'd1' => array(
'd12' = 'd12 value'
),
'd2' => 'd2 value'
),
'e' => 'e valu...
I was playing around with a code golf question yesterday for building a christmas tree which came around last year and I threw together a quick recursive algorithm to do the job:
static string f(int n, int r)
{
return "\n".PadLeft(2 * r, '*').PadLeft(n + r)
+ (r < n ? f(n, ++r) : "*".PadLeft(n));
}
I got to wondering if I ...
I am participating in Al Zimmermann's Programming Contest.
http://www.azspcs.net/Contest/SonOfDarts
I have written a recursive algorithm but it takes a long time to run. I was wondering what are the most important things to consider about speed of recursive algorithms. I have made most of the properties global so they don't get all...
Can any body tell how to write a multiplication function (in C) using recursion?
...
Hello!
Let's assume I have directories like:
dir1
main.cpp
dir2
abc.cpp
dir3
def.cpp
dir4
ghi.cpp
jkl.cpp
And let's assume that main.cpp includes dir2/abc.cpp and dir3/def.cpp, def.cpp includes dir4/ghi.cpp and dir4/jkl.cpp.
My question is, how can I have one Makefile/CMak...