Write an Assembly Language program StackReverse which uses the runtime stack to reverse an array Vector of N unsigned double-word integers.
public class GFG {
static void swap(char a[], int index1, int index2) {
char temp = a[index1];
a[index1] = a[index2];
a[index2] = temp;
}
static void reverse(char str[]) {
int n = str.length, i;
for (i = 0; i < n / 2; i++) {
swap(str, i, n - i - 1);
}
}
public static void main(String[] args) {
char str[] = "abc".toCharArray();
reverse(str);
System.out.printf("Reversed string is " + String.valueOf(str));
}
}
Write an Assembly Language program StackReverse which uses the runtime stack to reverse an array Vector...
C++ Write an implementation of the ADT stack that uses a resizable array (vector class of C++ STL) to represent the stack items. Anytime the stack becomes full, double the size of the array. Maintain the stack’s bottom entry at the beginning of the array the same way we did in array-based implementation.
Write common assembly language (RISC) programs to a) sum the first n elements of an array A, and b) compute r = ab for unsigned integers a and b. Each program will consist of a driver and a subprogram. The drivers will 1) read one or more values from the keyboard, 2) call the subprogram, and 3) print a result. The subprograms must not: ● store into memory, ● use registers $1 – $9, or ● make system calls
Write a program that uses a stack to reverse its inputs. Your
stack must be generic and you must demonstrate that it accepts both
String and Integer types. Your stack must implement the following
methods:
push,
pop,
isEmpty (returns true if the stack is empty and false
otherwise), and
size (returns an integer value for the number of items in the
stack).
You may use either an ArrayList or a LinkedList to implement
your stack. Also, your pop method must...
Assembly Language////Write a program that read in 10 integers from the user. Save the numbers into an array; reverse the array and display the reversed array. .data arrayInt DWORD 10 DUP(?) Your program consists of 4 procedures: 1. main procedure: call procedures getInput, reverseArray, displayArray 2. getInput procedure: prompt user to enter 10 integer numbers, save the numbers into the memory for the arrayInt 3. reverseArray: reverse arrayInt 4. displayArray: display the reversed array
Write a PIC 18F452 assembly program that uses an array of signed integers of 10 elements and computes the sum of all the elements in the array.
Write a program in ARM assembly language that copies each element of array A to consecutive fourth elements of array B, i.e., A[0] to B[0], A[1] to B[3], A[2] to B[7], etc. The array A is 12 elements long, and each element is a number that is 32 bits (1 word) wide. Assume the base address of array A is in register R2, and the base address of array B is in R3.
Write an Assembly language program to: A- Store the following text " Welcome to Assembly Language" in the ROM at 200H B- Find how many e letters in this word and store the count in the RAM in location 40H
Write an Assembly language program to: A- Store the following text " Welcome to Assembly Language" in the ROM at 200H B- Find how many e letters in this word and store the count in the RAM in location 40H
B) draw the runtime stack fall the steps
(a) write the output of the following program. The output must include everything that a computer may produce on its screen, including the prompts, input, output, and their positions. Suppose the input integers are 1 and 2, in this order. (b) Draw the run time stack for every step of execution on the next page. You need to mark the return address(es) yourself. #include <iostream> using namespace std; int a; int b;...
In assembly language, reverse an array of integers: # The array will be stored in memory # The location of arr[0] is SP # The location of arr[1] is SP+1 # The location of arr[2] is SP+2 # ... and so on # The size of the array N will be stored in SP-1 # The SP register may be initialized to any value 2: 1024; # Initialize the SP register to 1024 (start of the array) # ALL other...
HI CAN YOU PLEASE PROGRAM THIS ASSIGNMENT USING C++
Use a stack to reverse a word. A user enters a word and the reverse of the word is printed out. The characters are reversed using a stack. Hint: you can use the stackArray implementation we did in class today, but instead of an int arr[SIZE], you can use a char arr[SIZE]: class Stack char arr[SIZE]; // array to store Stack elements
Use a stack to reverse a word. A user...