Difference between revisions of "CSC231 Homework 10 2012"
(→Problem #2) |
|||
(7 intermediate revisions by the same user not shown) | |||
Line 4: | Line 4: | ||
This assignment is due on 11/28/12 evening, at midnight. | This assignment is due on 11/28/12 evening, at midnight. | ||
</bluebox> | </bluebox> | ||
− | + | <onlydft> | |
=Problem 1= | =Problem 1= | ||
+ | ( 1 point for documentation, 1 point for efficiency, 2 points for correctness of implementation) | ||
+ | <br /> | ||
− | + | Your assignment is to implement a recursive version of the Towers of Hanoi in assembly. | |
You can use this Python version for inspiration: | You can use this Python version for inspiration: | ||
Line 77: | Line 79: | ||
* Your program will also output at the end of the output the number of moves that were performed. You may not use a global variable to keep track of the count. If you are not sure how to do this in assembly, modify the python program to make it display the number of moves, then translate the python program in assembly. | * Your program will also output at the end of the output the number of moves that were performed. You may not use a global variable to keep track of the count. If you are not sure how to do this in assembly, modify the python program to make it display the number of moves, then translate the python program in assembly. | ||
− | =Problem #2= | + | ==Submission== |
+ | |||
+ | rsubmit hw10 hw10a.asm | ||
+ | |||
+ | =Problem #2: Optional and Extra Credits (0.6 points)= | ||
First study the program below, which is purposefully undocumented, and which computes the 46th term of the Fibonacci series using a recursive function. | First study the program below, which is purposefully undocumented, and which computes the 46th term of the Fibonacci series using a recursive function. | ||
Line 136: | Line 142: | ||
* Run the program: | * Run the program: | ||
− | + | ./recurseFib | |
− | * The output | + | * The output is: |
+-----------------+ | +-----------------+ | ||
Line 151: | Line 157: | ||
:indicating that fib(46) = 0x6d73e55f, or 1,836,311,903. More interestingly for us, the program takes a significant amount of time to compute this result. When I tested this program it took 19.39 seconds: | :indicating that fib(46) = 0x6d73e55f, or 1,836,311,903. More interestingly for us, the program takes a significant amount of time to compute this result. When I tested this program it took 19.39 seconds: | ||
− | '''time | + | '''time recursFib''' |
+-----------------+ | +-----------------+ | ||
Line 161: | Line 167: | ||
| edi = 0000 0000 | | | edi = 0000 0000 | | ||
+-----------------+ | +-----------------+ | ||
− | '''19.392u''' 0.006s 0:19.55 99.1% 0+0k 0+16io 0pf+0w | + | '''<font color="magenta">19.392u</font>''' 0.006s 0:19.55 99.1% 0+0k 0+16io 0pf+0w |
+ | |||
+ | ==Your assignment== | ||
+ | |||
+ | * Keep the recursive nature of the fib function but improve it so that the execution of the program becomes less than one second when launched on beowulf. | ||
+ | * How much stack space is used by your program, expressed in dwords or bytes.. Explain how you compute the amount of stack space in the header of your program. | ||
+ | |||
+ | ==Submission== | ||
+ | * Store your documented and modified program in a file called hw10b.asm and submit it as follows: | ||
+ | |||
+ | rsubmit hw10 hw10b.asm | ||
+ | |||
+ | </onlydft> |
Latest revision as of 17:38, 4 December 2017
--D. Thiebaut 20:51, 14 November 2012 (EST)
This assignment is due on 11/28/12 evening, at midnight.