Alice Community Recursion question

 Recursion question
 cedricdosss Junior Member   Status: Offline Posts: 10 Join Date: Nov 2012 Recursion question - 11-30-2012, 07:12 AM 7. Which of the following is best describes “recursion”: a. It is a loop identified during programming by the reserved word: RECURSION. b. It is a programming technique. c. It is a complex technique that should be avoided. d. It is similar to a random number generator. e. It is most like an infinite loop. I think the right answer is B 10. In Chapter 7, Table 7-2, of “Starting Out with Alice”, there are a number of functions associated with Lists. Suppose that you used the ‘size of list’ function on a list and it returned a value of 10. The list function “First item from list” returns the first item in the list. As noted, it is in position 0. Using the function “Last item from list”, then would return the last item. What “position” is this last item? a. Zero b. One c. Nine d. Ten 4. Which one of the following statements is true: a. A class cannot contain more than one method. b. The color red is an example of a method. c. Methods are part of a class. d. Methods in one class cannot call methods of another class.
 x2495iiii Super Moderator     Status: Offline Posts: 3,508 Join Date: Dec 2008 Location: Somewhere in the Continental U.S. 11-30-2012, 02:00 PM We can't help you with homework by simply telling you the right answers, but we can help you figure it out. For the first question, do you know what recursion is? It's when a method calls itself. Think about what that means. Second question: You should be able to figure that out yourself. If you're having trouble with simple questions like that, you're either not trying, or you need help from the teacher. Ask him/her after class if you can have some things explained to you. I'm really not trying to be a jerk here, I'm just trying to keep you from burning yourself later on. Third question: Two of the options are ridiculous and can be eliminated immediately. To find which of the two remaining options is right, you need to know what a class is, and what kinds of things classes can do. (')>
 nitp18 Junior Member   Status: Offline Posts: 2 Join Date: Jan 2013 Location: Warsaw, PL 01-24-2013, 03:55 AM x2495iiii tell answers http://interdomus.pl/interdomus/kuchnie http://www.admico.pl/zarzadzanie-nieruchomosciami Last edited by nitp18; 02-19-2013 at 05:42 AM.
 Brettlee Junior Member   Status: Offline Posts: 14 Join Date: May 2013 Location: New York 06-07-2013, 07:17 AM I think that the right answer is "d". Am I right??
 hollyrbraswell Junior Member   Status: Offline Posts: 4 Join Date: Jan 2016 01-30-2016, 12:45 AM i know this much only recursion is the repeated application of a recursive procedure or definition.
 Recursion
 chickentree Super Moderator   Status: Offline Posts: 250 Join Date: Dec 2012 Location: Frosno, Ca Recursion - 01-31-2016, 05:20 PM In order to forget recursion,you must first forget recursion. Is a toung in cheek way to remember it. On the one hand recursion can be an elegant solution to a complex problem while on the other hand, it's execution can be slow and resource intensive (using lot of memory, disk space or both.) Basically, if you can beappreak a problem's solution into smaller and easier to solve problems, you can use recursion to solve it. At the same time it should probably be made clear that any recursive method can be rewritten in a non-recursive way. A silly example: Code: ```count(int) if(int>0) return(count(int-1)+1) // the call that makes this a recurrence else return(0) // the condition that cause the recursion to end. So count(3) would result in: count(3) return(count(2))+1 return count(1)+1 return(count(0)+1) return(0)``` Which would call itself 4 times until the argument was 0 and then begin ending each recursive step back up the call chain returning 0, 1 , 2, and finally 3. Note that while the function is recurring, none of the previous calls can end. This is what uses up resources. Hope this helped, Mark Henwood mhenwood@ieee.org

 Thread Tools Display Modes Linear Mode

 Posting Rules You may not post new threads You may not post replies You may not post attachments You may not edit your posts BB code is On Smilies are On [IMG] code is On HTML code is Off Forum Rules
 Forum Jump User Control Panel Private Messages Subscriptions Who's Online Search Forums Forums Home Announcements     Community News and Announcements Alice 3     How Do I?     Works In Progress     Share Your World     Share Custom Classes     Bugs and Trouble Shooting     Suggestion Box Alice 2     How do I...?     Works-In-Progress     Share Worlds     Share Objects     Bugs and Troubleshooting     Suggestion Box Educators     Teaching with Alice     Teaching Using Alice 3     Teaching Using Alice 2     CS Principles and Alice     AP CSA and Intro to Java and Alice     Workshops     Alice Player and VR General Discussion     Questions and Comments     The Lounge