In MIPS
Create array of 11 float numbers, Call the procedures findLargestFloat, findSmallestFloat, and rangeFloat. Range float is the difference between largest float and smallest float. Also, Create a recursive procedure to find the largest (call it findLargestRecursive), to find largest float in array
.data
max: .word 3
temp: .word 1
num: .space 96
input1: .asciiz "Enter a number:\n" #prints the statement
output1: .asciiz "The number that is repeated more often than any
other is "
output2: .asciiz " with "
output3: .asciiz " repititions.\n"
output4: .asciiz "The array contains the following: \n"
.text
.globl main
main:
lw $t1, temp # loop counter
lw $t2, max # upper bound
la $t0, num # address of array
Loop:
# print input prompt
la $a0, input1
li $v0, 4
syscall
# get value from the user
li $v0, 6
syscall
# move user provided value from $f0 to array
s.s $f0, 0($t0)
# move to the next position in the array, increment loop
counter
addi $t0, $t0, 4
addi $t1, $t1, 1
ble $t1, $t2, Loop
# restore loop counter, and array address for printing
lw $t1, temp
la $t0, num
# print output prompt
la $a0, output4
li $v0, 4
syscall
print_loop:
# print number from the array
l.s $f12, 0($t0)
li $v0, 2
syscall
# print space
la $a0, 32
li $v0, 11
syscall
# increment loop counter and move to next value
addi $t1, $t1, 1
addi $t0, $t0, 4
ble $t1, $t2, print_loop
======================================================
Here is how it work
Enter a number:
2.3
Enter a number:
3.14
Enter a number:
5.55
The array contains the following:
2.3 3.14 5.55
In MIPS Create array of 11 float numbers, Call the procedures findLargestFloat, findSmallestFloat, and rangeFloat. Range...
write a MIPS program that does the following Create an array of 10 INTEGERS. Create procedures to find the largest, and find the smallest. Create another procedure called range, which is the difference between largest and smallest (range should call findLargest and findSmallest) Convert your find largest procedure to be recursive
Write a C program that uses the random number generator rand( ) to create an array with 20 numbers with value in the range from 1 to 100. The program calculates and displays the difference between the largest array element and the second largest array element in the array.
Write a C++ program that has an array of 20 integer numbers. It should call a function to initialize the array. Then it should call a function to find the smallest and average of the array.
Create a procedure to take three numbers from the caller and return the smallest of the three numbers. Also create a sample call to the procedure. This should be done in x86
Q-1: Write a program in Assembly language using MIPS instruction set that reads 15 integer numbers from user and stores all the numbers in the array intArray. Now, read another integer number N from the user, find the total number of array elements that are greater or equal to the number N, and the total number of array elements that are lower than the number N You must have two procedures: i. ReadIntegerArray: this procedure should read integer array elements...
For a 2-3 tree containing real numbers, design an algorithm for computing the range (i.e., the difference between the largest and smallest numbers in the tree) and determine its worst-case efficiency.
Write a C++ program that will create an array with a given number of elements. Use size = 10 for demonstration purposes, but write the program where the size of the array can be changed by changing the value of one constant. Fill the array with random numbers between 0 and 100. Write the program to perform the following operations: 1. Find and display the largest value in the array. 2. Find and display the smallest value in the array....
JAVA Objectives: 1. Apply linear search algorithm 2. Apply select sort algorithm 3. Apply array iteration skill Problem description: Write the following eight methods and write a main function to test these methods // return the index of the first occurrence of key in arr // if key is not found in arra, return -1 public static int linearSearch(int arr[], int key) // sort the arr from least to largest by using select sort algorithm public stati void selectSort(int arr[])...
Write a Java program with a single-dimension array that holds 11 integer numbers and sort the array using a bubble sort. Next, identify the median value of the 11 integers. Here are the steps your program must accomplish. algorithm (either flowchart or pseudocode) that you will use to write the program Step 1. Create an Place the algorithm in a Word document. 6. Ste the Step 2. Code the program in Eclipse and ensure the following steps are accomplished. 1....
(b) Given a set S of integers, the range of S is defined as the difference between the largest and the smallest integers in S. Write an algorithm to find the range of S and analyze its run-time (use big-O) in terms of IS| for each of the following cases: i. S is a sorted array of integers. ii. S is an un-sorted array of integers.