Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Instructions from your teacher: Write a subroutine that will count the number of zeros that occur in a given linked list of ints. The
Instructions from your teacher: Write a subroutine that will count the number of zeros that occur in a given linked list of ints. The subroutine should have the head as parameter and should return a value of type int. Note: Re implement addFirst(E e) method before using it as stated in the lecture Hint: When calling getElement() you should use explicit casting in order to convert the return number to Integer 2. Write a MIPS subroutine that implements a binary search. The subroutine is passed the address of an array in $a0, the number of values in the array in Sal and the search value in Sa2. The subroutine returns a 1 in $v0 when the search value is found in the array otherwise it returns a 0 in $v0. You do not have to write any code that calls the subroutine or any code that does 10 or halts the program. You only have to write the subroutine based on the parameters passed to the subroutine. Assume the array is sorted in ascending order. You might find it useful to use the srl (shift right logical) instruction to do integer division by 2. For example if St2 contains the value 10 then after executing the instruction, srl $t2, $t2, 1, $t2 has the value 5. As another example if $t2 contains the value 15 then after executing the instruction, srl St2, St2, 1, $t2 has the value 7.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started