Question: ( 1 5 pts ) Linked List IN LC 3 . A student wrote a subroutine to reverse a linked list, where each element consists

(15 pts) Linked List
IN LC3. A student wrote a subroutine to reverse a linked list, where each element consists of a pointer to
the next element and a value. The subroutine takes a pointer to the first element (the head) in
RO and returns a pointer to the new head in RO. However, it's not behaving as it should. Find
and correct the mistakes. Just like last time, there are 3 mistakes.
reverse
ST R1, reverse_r1
ST R2, reverse_r2
loop
LDR R2, R0, #0
STR R1, R0, #0
ADD R1, R0, #0
ADD R0, R2, #0
BRz loop
LD R1, reverse_r1
LD R2, reverse_r2
RET
reverse_r1.BLKW #1
reverse_r2.BLKW #1
( 1 5 pts ) Linked List IN LC 3 . A student wrote

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!