Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write a LC 3 - program to do a linear search for a key in an unsorted array. The number to search can be found

Write a LC3-program to do a linear search for a key in an unsorted array. The number to search can be found at label key
and should be stored in register R1. The number of elements in the array, found at label n
should be loaded into register R2, and the address of (the start of) the array, given by label data
, should be stored in register R3. Your program should determine the position of the key in the array ( which is a value between 0 to n1) if it exists and store this position in register R0. If the key is not in the array, store -1 in register R0.
You can use the following of LC-3 code as a starting point for your program. When handing in, use the data provided in the template. You DO NOT need to validate your inputs (that is, assume the inputs are valid)

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Design And Relational Theory Normal Forms And All That Jazz

Authors: Chris Date

1st Edition

1449328016, 978-1449328016

More Books

Students also viewed these Databases questions

Question

8. Design office space to facilitate interaction between employees.

Answered: 1 week ago