Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Need as soon as possible! Please code all three functions ( main , sort, search ) in program and follow instructions! Thank you! Question 4
Need as soon as possible! Please code all three functionsmain sort, search in program and follow instructions! Thank you! Question search.
The search function should do the following:
accept the number from main in the RCX register ie incoming frame macro should
be at least
create a local variable and save this number on the stack ie the second parameter
of frame macro should be at least
return in RAX register if the value is not found in the array
return the location of the value in the RAX register if the value is found in the array.
no other restrictions on number of used register.
no other restrictions is placed on stack use and local variables.
A sample search outline can be given as:
Constraints
Please note that values can only be passed into function using specific registers in strict
order. Also certain registers must be preserved inside functions. Therefore, care must be
taken in selection of which registers to use. Thank you, The last laboratory exercise requires you to code the Search and Sort algorithm from Lab
as functions in assembly.
Please create a file named SortSearchFun. asm in ebe.
Question Outline.
The sixth laboratory exercise required you to code the Insertion Sort algorithm and sort
a given array of integers and then find the index of a given value using the Linear Search
algorithm.
In this lab, you are required to split this code into three distinct functions:
main the main function, which will call the sort and search function, and handles the
user input and output functions.
sort function to sort the data using Insertion Sort Algorithm.
search function to search for a value in the sorted array using Linear Search Algo
rithm. The general outline of the code is given as: Question main.
The main function should do the following:
call the sort function
ask the user to input an unsigned integer number between inclusive in the
terminal, using scanf and save this number in the location val.
call the search function and pass the val to the function using the RCX register.
if the return value of the RAX register is then print to the terminal the string array
printfnotfound. This require the val as one of the parameters.
if the return value of the RAX register is the location of the found val, then print to
the terminal the string array printffound. This requires the val and the location
as returned by the RAX register. A sample main outline can be given as:Question sort.
The sort function should do the following:
sort the array in place using Insertion Sort Algorithm.
no restrictions on number of used register.
no restrictions is placed on stack use and local variables.
A sample sort outline can be given as:
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