[SOLVED] The aim of this task is to use all your MIPS knowledge (conditions, loops,

$25

File Name: The_aim_of_this_task_is_to_use_all_your_MIPS_knowledge_(conditions,_loops,.zip
File Size: 697.08 KB

5/5 - (1 vote)

The aim of this task is to use all your MIPS knowledge (conditions, loops, array access,
function definition, etc) together again. This task requires you to faithfully translate a
recursive function from python to MIPS.
Consider the following Python code, which defines the function

Copyright By Assignmentchef assignmentchef

binary_search(the _list, target, low, high), which searches for the target item in the
sorted list the list. The two parameters low and high, should indicate the sub list to
search in. Initially this should be set to low = 0 and high = len(the list) 1.
def binary_search(the _list: list, target: int, low: int, high: int)
if low > high:
mid = (high + low) // 2
if the list[mid] == target:
return mid
elif the list[mid] > target:
return binary_search(the_list, target, low, mid 1)
return binary_search(the _list, target, mid + 1, high)
def main() -> None:
arr = [1, 5, 10, 11, 12]
index = binary search(arr, 11, 0, len(arr) 1)
print (index)
You are asked to do two subtasks:
1. Properly document the task5.py file provided (in the scaffold), and add line by line
comments to the binary _search() function. Your comments should explain what each
line does.
2. Faithfully translate the above code (ignoring type hints) into a properly commented
MIPS program using the task5.asm file provided.

CS: assignmentchef QQ: 1823890830 Email: [email protected]

Reviews

There are no reviews yet.

Only logged in customers who have purchased this product may leave a review.

Shopping Cart
[SOLVED] The aim of this task is to use all your MIPS knowledge (conditions, loops,
$25