Computer Science Canada Programming C, C++, Java, PHP, Ruby, Turing, VB   Username:   Password: Wiki   Blog   Search   Turing   Chat Room  Members
recursion
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~

Paul

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.
nelson

Posted: Sun Feb 01, 2004 10:37 pm   Post subject: (No subject)

yup
Paul

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.
jonos

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.
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!
Paul

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.
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

Paul

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
jonos

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.
Paul

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"
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
jonos

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
santabruzer

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.
jonos

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
 Display posts from previous: All Posts1 Day7 Days2 Weeks1 Month3 Months6 Months1 Year Oldest FirstNewest First

Page 1 of 1  [ 15 Posts ]
 Jump to:  Select a forum  CompSci.ca ------------ - Network News - General Discussion     General Forums   -----------------   - Hello World   - Featured Poll   - Contests     Contest Forums   -----------------   - DWITE   - [FP] Contest 2006/2008   - [FP] 2005/2006 Archive   - [FP] 2004/2005 Archive   - Off Topic     Lounges   ---------   - User Lounge   - VIP Lounge     Programming -------------- - General Programming     General Programming Forums   --------------------------------   - Functional Programming   - Logical Programming   - C     C   --   - C Help   - C Tutorials   - C Submissions   - C++     C++   ----   - C++ Help   - C++ Tutorials   - C++ Submissions   - Java     Java   -----   - Java Help   - Java Tutorials   - Java Submissions   - Ruby     Ruby   -----   - Ruby Help   - Ruby Tutorials   - Ruby Submissions   - Turing     Turing   --------   - Turing Help   - Turing Tutorials   - Turing Submissions   - PHP     PHP   ----   - PHP Help   - PHP Tutorials   - PHP Submissions   - Python     Python   --------   - Python Help   - Python Tutorials   - Python Submissions   - Visual Basic and Other Basics     VB   ---   - Visual Basic Help   - Visual Basic Tutorials   - Visual Basic Submissions     Education ----------- - Student Life   Graphics and Design ----------------------- - Web Design     Web Design Forums   ---------------------   - (X)HTML Help   - (X)HTML Tutorials   - Flash MX Help   - Flash MX Tutorials   - Graphics     Graphics Forums   ------------------   - Photoshop Tutorials   - The Showroom   - 2D Graphics   - 3D Graphics     Teams ------ - dTeam Public

 Style: Appalachia blueSilver eMJay subAppalachia subBlue subCanvas subEmjay subGrey subSilver subVereor Search: