COMP 231 - Assignment 4 |
Due in class, Thurs. April 5 |
In this assignment you are to modify and extend the MIPS assembly program you wrote in assignment 3 as follows:
An example a log of a session with your new program might look like:
Command: 11
Command: 13
Command: 11
Command: 3
3
Command: 2
2
Command: 1
2
Command: 50
Good-bye!
To be handed in: (1) A complete listing of your fully documented code. Almost every line of code should have a comment. (2) The log of one session which fully tests your code. Make sure your session tests all features of your program. (3) Email me your dot s file.
Here is the pseudocode for recursive binary search:
Find(x) /* n = size of list if n = 0 return 0 else return BinSearch(x,1,n) BinSearch(x,a,b) /* Search for x in sorted list between index a and b /* list(i) is the element of index i in the list /* ceiling(y) is the least integer greater or equal to y if b=a and list(a) <= x return a else return a-1 c = ceiling((a+b)/2) if list(c) <= x return BinSearch(x,c,b) else return BinSearch(x,a,c-1)
Report problems to dkrizanc at wesleyan dot edu
![]() |