Author |
Message |
nelson
|
Posted: Sun Feb 01, 2004 10:27 pm Post subject: recursion |
|
|
i'm trying to solve this problem
" Write a function using Recursion to display all anagrams of the word 'RECURSION' "
having trouble, i started though
code: |
var str : string
str := "recursion"
var b : array 1 .. length (str) of int
var a : array 1 .. length (str) of string (1)
for i : 1 .. length (str)
b (i) := 0
a (i) := ""
end for
var temp : string
temp := str
proc er (n : int)
for i : 1 .. length (str)
a (n) := str (i)
if n < length (str) then
er (n + 1)
else
for k : 1 .. length (str)
put a (k) ..
end for
put ""
end if
end for
end er
put length (str)
er (1)
|
heh -.,-;;;;;;;; help~ |
|
|
|
|
![](images/spacer.gif) |
Sponsor Sponsor
![Sponsor Sponsor](templates/subSilver/images/ranks/stars_rank5.gif)
|
|
![](images/spacer.gif) |
Paul
![](http://i12.photobucket.com/albums/a207/paulbian/DDRDuck.png)
|
Posted: Sun Feb 01, 2004 10:33 pm Post subject: (No subject) |
|
|
Isn't an anagram words made by rearranging the letters of the same word? correct me if Im wrong, Im not sure. |
|
|
|
|
![](images/spacer.gif) |
nelson
|
Posted: Sun Feb 01, 2004 10:37 pm Post subject: (No subject) |
|
|
yup |
|
|
|
|
![](images/spacer.gif) |
Paul
![](http://i12.photobucket.com/albums/a207/paulbian/DDRDuck.png)
|
Posted: Sun Feb 01, 2004 10:39 pm Post subject: (No subject) |
|
|
Oh! At first I thought you wanted all the "real" words anagram, but you just want all possible combinations right? I think I'll work on that for a bit. |
|
|
|
|
![](images/spacer.gif) |
jonos
![](http://jonos.f2g.net/pictures/rankca.gif)
|
Posted: Sun Feb 01, 2004 10:39 pm Post subject: (No subject) |
|
|
i think what you have is right, cause it does print out the whatchamacallits, but i've never used recursion (haven't been taught it in stupid compsci), so i wouldn't really know if you were doing it right. |
|
|
|
|
![](images/spacer.gif) |
nelson
|
Posted: Sun Feb 01, 2004 10:40 pm Post subject: (No subject) |
|
|
haha if we wanted to do real words,
we would need a dictionary! |
|
|
|
|
![](images/spacer.gif) |
Paul
![](http://i12.photobucket.com/albums/a207/paulbian/DDRDuck.png)
|
Posted: Sun Feb 01, 2004 10:41 pm Post subject: (No subject) |
|
|
when I run it, theres alot of words with 4 "R"'s and there arn't 4 of them in Recursion. |
|
|
|
|
![](images/spacer.gif) |
nelson
|
Posted: Sun Feb 01, 2004 10:41 pm Post subject: (No subject) |
|
|
but the program can only use two r
R ecu R sion
my program starts with 9 Rs |
|
|
|
|
![](images/spacer.gif) |
Sponsor Sponsor
![Sponsor Sponsor](templates/subSilver/images/ranks/stars_rank5.gif)
|
|
![](images/spacer.gif) |
Paul
![](http://i12.photobucket.com/albums/a207/paulbian/DDRDuck.png)
|
Posted: Sun Feb 01, 2004 10:47 pm Post subject: (No subject) |
|
|
I see, well I'm sorry, but I can't help you right now, I have to go to bed, but I'll think on it whenver I have the chance. I dunno though, if it was me making it, I'd count the numbers of each letters, might be a stupid idea, Im too tired to think ![Confused Confused](http://compsci.ca/v3/images/smiles/icon_confused.gif) |
|
|
|
|
![](images/spacer.gif) |
jonos
![](http://jonos.f2g.net/pictures/rankca.gif)
|
Posted: Sun Feb 01, 2004 10:50 pm Post subject: (No subject) |
|
|
i didn't even notice that (the 4 rs), id help if i could cause i have lots of time, but i have no idea what recursion is. |
|
|
|
|
![](images/spacer.gif) |
Paul
![](http://i12.photobucket.com/albums/a207/paulbian/DDRDuck.png)
|
Posted: Sun Feb 01, 2004 10:51 pm Post subject: (No subject) |
|
|
It isn't recursion I think, hes trying to get anagrams (words that are made of the same letters) from the word "recursion" |
|
|
|
|
![](images/spacer.gif) |
nelson
|
Posted: Sun Feb 01, 2004 10:53 pm Post subject: (No subject) |
|
|
but it's supposed to be recursion problem
so probably we hve to use recursion |
|
|
|
|
![](images/spacer.gif) |
jonos
![](http://jonos.f2g.net/pictures/rankca.gif)
|
Posted: Sun Feb 01, 2004 10:58 pm Post subject: (No subject) |
|
|
could anyone explain to me what recursion is, then maybe i could have a go at it... thankyou ![Laughing Laughing](http://compsci.ca/v3/images/smiles/icon_lol.gif) |
|
|
|
|
![](images/spacer.gif) |
santabruzer
![](http://www.pureoc.d2g.com/uploaded_images/9853.jpg)
|
Posted: Sun Feb 01, 2004 11:00 pm Post subject: (No subject) |
|
|
enjoy:
Quote: A function that calls a simpler version of itself to arrive at a solution. For example, the factorial function (n!) can be defined recursively as (n(n-1)!), where (0!) is defined as equal to1. If a function calls another function that calls back the original function again, it is called mutual recursion; most ray-tracing programs fall into this general category.
|
|
|
|
|
![](images/spacer.gif) |
jonos
![](http://jonos.f2g.net/pictures/rankca.gif)
|
Posted: Sun Feb 01, 2004 11:17 pm Post subject: (No subject) |
|
|
uh, thanks for that definition, could yo uplease translate it into laymans terms thanks for the definition, i think i have an idea of what it is |
|
|
|
|
![](images/spacer.gif) |
|