Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Please answer fully and in MIPS assembly language. Write a search function that

ID: 3776539 • Letter: P

Question

Please answer fully and in MIPS assembly language.

Write a search function that takes three input parameters: an array's starting address, the array size, and a seed value to be found; and returns two results: the index of the first location where the value is greater than the seed value (if not found, return -1), and how many elements in the array that are greater than the seed value. For example, in array of 1, 5, 4, 6, 3, 5, 2, 10, we search for the seed value of 4. The return value should be 1 and 4. (i.e. the first element with value greater than 4 is in index 1, and there are four elements with value greater than 4.) Also, write a main program that calls the search function three times using the data sets below: the above array of 8 elements and search for 4; an array of 10 elements 1, -1, 2, -2, 3, -3, 4, -4, 5, -5 and search for 10; an array of 30 elements 28, -17, 0, 51, -12, 11, 5, 22, -2, -9, 13, 16, 2, 1, 36, -13, -32, -71, 101, 30, 130, -120, 13, 11, -91, 14, 48, 53, -50, 44, and search for 13. Write a function AVA(8iX, 8iY, 8iZ, n, s, t) to perform the following absolute value vector addition, such that X_i = |Y_i| + |Z_i| + 2 times s + t; for 0 lessthanorequalto i lessthanorequalto n - 1 where &X;, &Y;, and &Z; refer to the array X, Y, Z's starting address, n is the size of the array, and s and t are integers. Please use the stack to pass these six parameters. Also, write main programs that call the AVA function on the following data sets (please prepare two separate program files, one for each data set) n = 5, s = 2, t = 1, Y = {1, 2, 3, 4, 5}, and Z = {-5, -4, -3, -2, -1} n = 10, s = 3, t = 2, Y = {-1, 3, -5, 7, -9, 2, -4, 6, -8, 10}, and Z = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10} (For each data set, the main program should first print out Y and Z arrays, and then to calculate X, and finally prints out X array.)

Explanation / Answer

First i'm making the list in Ascending order and then search for the Element

#include <stdio.h>

void main()

{

int i, j, a, n, array[];

printf("Enter size of the array:");

scanf("%d",&n);

printf("Enter Array Elements:");

for(i=0;i<n;i++)

scanf("%d",&array[i]);

for(i=0;i<n;i++)

{

for(j=0;j<n;j++)

{

if(array[i]>array[j])

{

a = array[i];

array[i]=array[j];

array[j]= a;

}

printf("The ascending order of Elements are :");

for(i=0;i<n;i++)

{

printf("%d",array[i]);

}

}

int searchelement();

}

}

int searchelement()

{

int ele;

printf("Enter Element to be search:");

scanf("%d",&ele);

while(i<n && ele !=a[i])

{

i++;

}

if(i<n)

{

printf("Number found at location %d", i+1);

}

else if {

printf("The Numbers greater than seed elements are : %d ", strlen(array[i]-(i+1)));

return -1;

}