1- Write a program in MIPS assembly language to calculate the sum of a list of positive numbers. The list is terminated by a zero. Test your program with this list: 11, 12, 13,14, 15, 16, 17, 18, 19, 20,0. Provide your .asm file so that I can run it on MARS Simulator. 2- In this program you calculate the sum of m data sets. Each data set contains n integer numbers. In the following example there are 3 data sets, each having 10 elements:
Q: Stack data structure is implemented using pointers
A: #include <iostream> using namespace std;struct node{int data;node *next;};class stack{node…
Q: Read the txt file in Python and display the output in a separate txt file as shown below; Input txt…
A: file1 = open("bartlleby10.txt") r=file1.read()l1=[]l2=[]c=0for i in r.split("\n"): b=i.split()…
Q: USING LC3 Stacks or Register Preservation In LC3, Write a subroutine to divide the value stored at…
A: A subroutine to divide the value stored at R2 (dividend) with the value stored at R3 (divisor) (R2 /…
Q: 1) The R programming code shown below will produce the following output: Output: one two 1 1 TRUE…
A: 1) The R programming code shown below will produce the following output: Output: one two 1 1…
Q: • Please simulate a Best Fit memory block allocation algorithm. • Your program runs without command…
A: Code :-
Q: A1 The input file A1(input).txt has the following content for example: [a,b], [12, 'y']['1', 2, ¹2…
A: Program: import refile_obj = open("C:/Users/ketan/Desktop/A1.txt", "r")word_list_file=…
Q: What is the content of the list ls2 when the following Python statements are executed?
A: range function accepting a parameter which is the last value excluding that So, now ls1 list will…
Q: Problem 1.2 Write a program that opens a text file ("input.txt") and reads its contents. Then using…
A: Actually, program is an executable software that runs on a computer.
Q: Please explain your reasoning. int bof(char *str, int size) { char *buffer = (char *)…
A: To some extent... If you are trying to use the malloc function then the memory that gets allocated…
Q: ; output: exe .stack 64h .data .code msg db "Hello, World", 24h mov ax, @data mov ds, ax mov dx,…
A: A flowchart is a graphical representation of an algorithm. Programmers often use it as a program…
Q: C++, how do I read a file with numbers Such as 1,2 3,4 5,6 and place it into a linked list with…
A: #include <bits/stdc++.h> using namespace std; int main() { char fname[1024]; printf("Enter…
Q: Which registers do we need to preserve using the stack before the function call? .data str1: .asciiz…
A: Solution:-- 1)The given question is related with an multiple choice question to be answered in the…
Q: Próblém B. Comparator Input file: Output file: standard input standard output 2 seconds Time limit:…
A: Code: #include <iostream>using namespace std;int main(){ //declaring required variables…
Q: When will the function whatlslt cause a stack overflow (i.e. cause the computer's memory to be…
A: I have given an answer in step 2.
Q: int bof(char *str, int size) { char *buffer = (char *) malloc(size); strcpy(buffer, str);…
A:
Q: Write a program that will take n floating point numbers as input and print the sum, average and…
A: Since no programming language is mentioned, I am using c language. Algorithm: Start Read n value…
Q: in the busy list occurs when a memory block between two other busy memory blocks is returned to the…
A: Dynamic partitions are a user space partitioning system for Android. With this partitioning system,…
Q: Write C code which will read a line of characters (terminated by a \n) from input_file into a…
A: C Program: #include <stdio.h>#include <stdlib.h> int main() { char c[1000]; FILE…
Q: USING PYTHON: Given a list of 10 names, complete the program that outputs the name specified by the…
A: PROGRAM CODE: names = ['Ryley', 'Edan', 'Reagan', 'Henry', 'Caius', 'Jane', 'Guto', 'Sonya',…
Q: Write a python program that takes two lists as input from the user, multiplies the index wise…
A: Here I have taken input from the user and then stored it in 2 different lists. Next, I have used try…
Q: Reverse a String “Towson University” with the following requirements: Use a loop with indexed…
A: STR1 DB 0DH,0AH, \'Please insert a string :- $\' STR2 DB 0DH,0AH, \'Your reversed…
Q: This is a program to print fibonacci series in assembly. Can you explain it line by line? .MODEL…
A: Answer: I have done code and also I have attached code as well as code screenshot.
Q: PLease use c++ to read files from a .txt file and store it in a heap memory and then allow user to…
A: Please upvote me Please I need it badly. Please. I am providing you the correct answer below.…
Q: 2. Write a program to perform the following operations on a stack: push(800), push(100), pop( ),…
A: Step 1: create global variable stack[] ,top = -1, n =100 Step 2 : Create push() function, for…
Q: Computer Science Write a C++ language program that reads the file numbers.txt having 10,000 random…
A: Рrime numbers аre the numbers whiсh hаve 2 divisоrs оnly i.e. the number thаt саn be…
Q: PLEASE HELP ME TRANSFER THIS PYTHON CODE TO MIPS ASAP PLEASE I WILL GENUINELY BE THANKFUL from…
A: Solution:-- 1)The given question says that the given code provided is in the Python language.…
Q: a list to store processes is used in this program, is it a queue or a general-purpose list?…
A: That program contain the process cycle , Burst Time , Waiting Time and Turnaround time so we can say…
Q: 2. Write C code which will read a line of characters (terminated by a \n) from input file into a…
A: Given:- Write C code which will read a line of characters (terminated by a \n) from input_file…
Q: Write a python program that takes two lists as input from the user, multiplies the index wise…
A: Create two list li1 and li2 using comprehensive for loop input for two lists are read perform…
Q: to modify my code to make it check if my input .cpp source files are balanced in single and double…
A: #include <iostream> // Provides cin, cout#include <stack> // Provides stack#include…
Q: I need help in this C program. Assume two lists of integers both in ascending order. The first list…
A: The C program is given below with code and output screenshots Happy Coding ?
Q: Write a program in MIPS that does the following: Request the name of a file from the user and open…
A: Write a program in MIPS that does the following: Request the name of a file from the user and open…
Q: 1. Write a program in C to create a singly linked list of n nodes and display it in reverse order.…
A: To write: To write a program in C to create a singly linked list of n nodes and display it in…
Q: . What is the output of the following code (assume all libraries are included): Answer: a) True b)…
A: Here we have given multiple question. In first question we need to find the output of the given…
Q: Write a python program that has the following functionality: 1. read input from a file containing a…
A: Task :- Write a python program to read words from input file and write to output file selecting one…
Q: using STL in c++, sort the given numbers in the input.txt file by only using heap data container.…
A: #include <iostream>#include <fstream>#include <vector>using namespace std;using…
Q: can you modify the program below to prompt for 3 numbers, calculate the sum, and output the result.…
A: can you modify the program below to prompt for 3 numbers, calculate the sum, and output the result.…
Q: Twist this assembly code, but this time a program asks the user to write anything and the written…
A: Solution:-- 1)The given question has required for the solution to be provided with the inclusion…
Q: What will be the stack content after following operations: Push 5 Push 8 Pop Push 1 Push 12…
A: Stack is Last-in-first-out data structure. Element which is inserted in the last will be popped out…
Q: Write the assembly code that reads string from "input.txt" file and check whether the readed string…
A: Given that Write an assembly program to check whether a given string is palindrome or not.…
Q: Write a C++ program which reads an int array of size 10 from a “file.txt”. Multiplies 3 from each…
A: #include <fstream>#include <iostream>#include <sstream> using namespace std;int…
Q: Please answer in C++, show compiled output as well thank you given N numbers in p1,p2,p3…pn, we…
A: There can be two approach to this question: Hashing Approach Graph Approach
Q: In C# Suppose variable nums contains a list of integers. List«Integer> nums = Arrays.asList(1, 1,…
A: The java streams are introduced in java version 8. The java streams are used for the computation of…
Q: READING CODE - STACK 2 47 mov al, 0; Return code of 0 mov ah, 4ch: Exit back to MSDOS int 21h list…
A: What is the purpose of lines 36 and 37? How does the assembler know where the start of the program…
Q: How many hexadecimal digits are used when representing a nibble in hex form? 01 0 3 02 00 Patti the…
A: The above question is solved in step 2 :-
Q: Using Java, write a simple Insertion Sort program that can read in integers from a text file (line…
A: //Java Source Code :- import java.io.BufferedReader; import java.io.BufferedWriter; import…
Q: 1. Write a program that reads two strings from the keyboard using a while loop A.Terminate the loop…
A: As per our company guidelines, we are supposed to answer only one question per post and kindly…
Q: Write a program called p2.py that has the following functionality: 1. read input from a file…
A: import random # Importing random packagef1=open("inputFile.txt","r") # Opening file f1 in read…
Q: Write code to read the content of the text file input.txt . ● For each line in input.txt , write a…
A: Note: The programming language is missing in the question. So we will answer this program in Python…
Q: Write a program to process stock data. The stock data should be read from a text file containing the…
A: import java.io.BufferedReader;import java.io.FileReader;import java.io.InputStreamReader;import…
Step by step
Solved in 4 steps with 2 images
- 1. Write a program to reverse a singly or doubly linked list. (take data as int)2. Write a program to remove duplicates from a doubly linked list. (1,2,3,4,5,2) (you will remove the 2nd duplicate).3. Write a program to swap two data items in a doubly linked list. swap number 2 and number 4 data with each other. course--data structure in c++ perform all three parts in the one cpp file.2. For the code below, draw a picture of the program stack when the function partition() is called the 2nd time. # extracted from suquant's reply at # https://stackoverflow.com/questions/18262306/quicksort-with-python def partition(array, begin, end): pivot = begin for i in range(begin+1, end+1): if array[i] <= array[begin]: pivot += 1 array[i], array[pivot] = array[pivot], array[i] array[pivot], array[begin] = array[begin], array[pivot] return pivot def quicksort(array, begin, end): if begin >= end: return pivot = partition(array, begin, end) quicksort(array, begin, pivot-1) quicksort(array, pivot+1, end) # added calling code if __name__ == "__main__": mylist = [8, 2, 17, 4, 12] quicksort(mylist, 0, 4)I need help to modify my code to make it check if my input .cpp source files are balanced in single and double quotes. My code below can determine whether parenthesis and curly brackets are balanced in a .cpp source file.. Here is my code: // A small demonstration program for a stack.#include // Provides cin, cout#include // Provides stack#include // Provides string#include //Creates and/or read filesusing namespace std; // PROTOTYPE for a function used by this demonstration programbool balancedSymbols(const string& sym);// Postcondition: A true return value indicates that the parentheses in the// given expression are balanced. Otherwise, the return value is false. int main(){string userInput; cout << "Enter a .cpp source file to check if symbols are balanced\n";getline(cin, userInput);if (balancedSymbols(userInput))cout << "The parentheses and curly brackets in the source code are balanced.\n";elsecout << "The parentheses and curly brackets in the source code are…
- using STL in c++, sort the given numbers in the input.txt file by only using heap data container. your sorted numbers should be written to the output.txt file (i)your code can be tested with an input file which comtains 1 million random numbers (ii) Execution time < 1 sec (iii) memory limit < 64MBc++ Use the "natural split" algorithm on the file split.txt and answer the following question: How many elements are in the first list? display first list and second list split file: 200 494 774 644 345 521 61 27 28 584 569 66 857 210 2 211 675 548 596 188 647 671 517 408 475 615 113 731 522 850 17 640 940 556 517 602 935 76 578 880 428 168 394 381 497 247 368 137 138 619 973 895 106 838 45 921 800 681 660 490 427 937 917 786 959 152 604 837 749 684 963 926 963 988 492 385 458 788 7 62 46 932 996 787 634 34 616 71 128 686 578 923 532 933 545 100 224 895 595 342 933 934 797 120 565 495 884 237 648 843 599 157 843 192 279 301 649 382 881 667 178 126 746 44 601 22 52 769 708 991 83 447 786 525 168 328 922 153 367 22 689 834 774 93 110 547 597 644 726 237 20 370 573 391 225 750 897 956 839 951 455 8 509 746 338 576 276 277 341 274 891 723 53 966 271 50 990In C# Suppose variable nums contains a list of integers.List«Integer> nums = Arrays.asList(1, 1, 2, 3, 4, 1, 3, 2, 4, 3, 3, 1);var nums = new List«int> { 1, 1, 2, 3, 4, 1, 3, 2, 4, 3, 3, 1 }Using Java Stream API *or* LINQ, write a short code that prints the following.For each section indicate the platform (whether the solution is given in Java orC# LINQ).A) Print all numbers.B) Print the sum() of the numbers.C) count how many times number '1' appears in the list.
- C Programming: Write a separate program that takes one command line argument indicating a binary stack file (e.g., stack.bin). Provide an appropriate error message in case of a missing filename or error opening it. The program should visualize the stack frame and call information in the file as shown in the following sample output: Sample Output: function: 0x5639db7fc2ca, caller: 0x7f8b8f372290, frame pointer: 0x7ffd23831080stack frame: 0x7ffd23831080-0x7ffd23831070, time: 0.003484 (2158-5642)address range initial final0x7ffd2383107f-0x7ffd2383107c: 00007f8b | 00007f8b0x7ffd2383107b-0x7ffd23831078: 8f372290 | 8f3722900x7ffd23831077-0x7ffd23831074: 00000000 | 000000000x7ffd23831073-0x7ffd23831070: 00000001 | 00000001 function: 0x5639db7fc1d9, caller: 0x5639db7fc2f3, frame pointer: 0x7ffd23831060stack frame: 0x7ffd23831060-0x7ffd23831030, time: 0.002587 (2173-4760)address range initial final0x7ffd2383105f-0x7ffd2383105c: 00005639 |…Python please: Write a program that reads the integers user_index_num and user_element_value as input, and update the list index element with user_element_value. Then output the list. Note: The list given is list = [1,2,3,4]. Use a try block to perform all the statements. Use an except block to catch any IndexError and output an exception message. Use another except block to catch any ValueError caused by invalid input and to output an exception message. Note: Please use list = [1,2,3,4]. IndexError is thrown when an index that is not bound in the list happens. Output wording should match examples below ValueError is thrown when a user enters a value of a different data type than what is defined in the program. Output wording should match example below. Example: If the input of the program is 2 5 the output of the program is [1, 2, 5, 4] Example: If the input of the program is 15 3 the output of the program is Index 15 Error list assignment index out of range Example: If the input of…Create a software that can read an arbitrary number of lines of VB.NET code and save reserved words in one linked list and identifiers and literals in another. Display the contents of each linked list when the programme has completed reading input.
- Write a program to process stock data. The stock data should be read from a text file containing the following data: stock code, stock name, amount invested (XXX.XX), shares held, and current price. Sue the internet or your local paper to gather data on at least 20 stocks. As each stock is read, insert it into a doubly linked list. The first logical list should be ordered on the stock code. The second should be ordered on the gain or loss for the stock. Gain or loss is calculated as the current value of the stock (shares held times current price) minus the amount invested. Include at least one loss in your test data. After building the lists, display a menu that allows the user to display either logical list forward or backward (a total of four options). Each display should contain an appropriate heading and column caption. Run your program and submit a list of your input data and a print out of each display option.using c++ create a linked list so that the linked list can read content from a binary file and write the list back to a binary file. The binary file to read should look something like this: 9 -3 5 2 6 8 it should have a list of integers to read into your linked list, NOT a list of commands like: L1.insertTail(5);you need to design, analyze, and implement algorithms to read in a sequence of characters from standard input and maintain the characters in a linked list with no duplicates. When you read in a previously unseen character, insert it at the front of the list. When you read in a duplicate character, delete it from the list and reinsert it at the beginning. The program implements the well-known move-to-front strategy which is useful for caching, data compression, and many other applications where items that have been recently accessed are more likely to be re-accessed. Requirements: The program should read a sequence of characters. The program should insert unseen character at the front of the list. The program should check if the character is not in the list to be inserted at the front of the list. The program should delete a duplicate character and delete it from the list and insert it at the beginning of the list. The program should check if the character is already in the list and…