Question: Please write in LC3-Assembly language only 5 Write a program to do a linear search in an unsorted array. The number to search can be
Please write in LC3-Assembly language only


5 Write a program to do a linear search in an unsorted array. The number to search can be found at label key and should be stored in r1, the number of elements in the array n should be stored in r2 and the address of the array should be stored in r3. The program should determine the position of the element (0 to n-1) or -1 to indicate not found and store t in r0. Finally print the position the result (see below) fill 12 ;array size, do not assume that in12 in the program code data fill 100 .fill 29 .fill 16 .fill 60 .fill 123 .fill0 .fill 76 key .fill 29 number to search for Try searching for key-29,-64, 33, -6 (you will have to re-run the program for each value of key). Output the position where the number was or a message saying Not found. When the position the key was found in is 9". For each of the test cases key-29,-64, and 33,-6, your output should look like the following. Found at position: 1 Found at position: 9 Not found Found at position: 9 Please use the data as provided above (with key-29) when submitting your source code. 5 Write a program to do a linear search in an unsorted array. The number to search can be found at label key and should be stored in r1, the number of elements in the array n should be stored in r2 and the address of the array should be stored in r3. The program should determine the position of the element (0 to n-1) or -1 to indicate not found and store t in r0. Finally print the position the result (see below) fill 12 ;array size, do not assume that in12 in the program code data fill 100 .fill 29 .fill 16 .fill 60 .fill 123 .fill0 .fill 76 key .fill 29 number to search for Try searching for key-29,-64, 33, -6 (you will have to re-run the program for each value of key). Output the position where the number was or a message saying Not found. When the position the key was found in is 9". For each of the test cases key-29,-64, and 33,-6, your output should look like the following. Found at position: 1 Found at position: 9 Not found Found at position: 9 Please use the data as provided above (with key-29) when submitting your source code
Step by Step Solution
There are 3 Steps involved in it
Heres an LC3 assembly program to perform a linear search in an unsorted array assembly Initialize register variables ORIG x3000 LD R1 KEY Load the key ... View full answer
Get step-by-step solutions from verified subject matter experts
