2. Given array int a[5]={ 9, 3, 22, 8, 1}; Write assembly program to sort array...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
2. Given array int a[5]={ 9, 3, 22, 8, 1}; Write assembly program to sort array a. The following is code to sort array a in C++ using Bubble sort void swap (int a, int b) { int temp; temp=a; a=b; temp=b; } void Bsort(int a[], int n) for(int i=0; i<n-1; ++i) { for(int j=0; j<n-1; ++j) { } } Use xchg if( a[i]> a[i+1] ) { swap(a[j], a[j+1]); } Sample I/O Original array a: 9 3 22 8 1 Sorted array a : 1 3 8 9 22 mem, eax; swaps two items. Both memory operands is illegal 2. Given array int a[5]={ 9, 3, 22, 8, 1}; Write assembly program to sort array a. The following is code to sort array a in C++ using Bubble sort void swap (int a, int b) { int temp; temp=a; a=b; temp=b; } void Bsort(int a[], int n) for(int i=0; i<n-1; ++i) { for(int j=0; j<n-1; ++j) { } } Use xchg if( a[i]> a[i+1] ) { swap(a[j], a[j+1]); } Sample I/O Original array a: 9 3 22 8 1 Sorted array a : 1 3 8 9 22 mem, eax; swaps two items. Both memory operands is illegal
Expert Answer:
Answer rating: 100% (QA)
Heres an assembly program using xchg to implement bubble sort for the given array assembly section d... View the full answer
Related Book For
Microsoft Visual C# An Introduction to Object-Oriented Programming
ISBN: 978-1337102100
7th edition
Authors: Joyce Farrell
Posted Date:
Students also viewed these programming questions
-
Consider each matrix as the augmented matrix of a linear system. State in words the next two elementary row operations that should be performed in the process of solving the system. 1-6 4 2 -7 0 0...
-
The model of competitive markets relies on the following four core assumptions: 1. There must be many buyers and sellers, none of which is large in relation to total sales or purchases. In other...
-
"Multiple IRRs. The Fairmont Corporation is planning on erecting an exhibit for the next state fair. The exhibit will require a cash outlay of $100,000 at the first of this year. Expected gate...
-
An analyst expects that 20% of all publicly traded companies will experience a decline in earnings next year. The analyst has developed a ratio to help forecast this decline. If the company is headed...
-
(a) A direction field for the differential equation y = y(y 2) (y 4) is shown. Sketch the graphs of the solutions that satisfy the given initial conditions. (i) y (0) = 0.3 (ii) y (0) = 1 (iii) y (0)...
-
In Vogue, a T-shirt business, is growing fast and needs a better accounting information system. Consider the features of an effective system. Which features are most important? Why? Which feature...
-
White Company can invest in one of two projects, TD1 or TD2. Each project requires an initial investment of $101,250 and produces the year-end cash inflows shown in the following table. Required 1....
-
Scenario 11:Accountant 11 is a senior accountant. She says: I recommended a wonderful coffee serviceto my audit client, I received a commission from the coffee service company, can I take...
-
The proposed rates were not in the range the CEO expected given the pricing analysis. The CEO has asked the pricing actuary to verify the total projected loss cost excluding potential large storm...
-
It has been said that data is the fuel of the 21stCentury. In fact, beyond personnel, data is probably the single most important asset held by an organization. As your organization's database...
-
What are economies of scope?
-
In September 2015, several acres of sugar crop was damaged due to a faltering monsoon in India, the worlds second-biggest producer of sugar. Farmers in certain states were forced to use damaged crops...
-
What is a capability?
-
What is an acquisition premium?
-
What is a technological discontinuity?
-
Prepare White Photography's bank reconciliation at November 30, 2018 Prepare the bank portion of the reconciliation, followed by the book portion of the reconciliation (If a box is not used in the...
-
How do individual companies respond to economic forces throughout the globe? One way to explore this is to see how well rates of return for stock of individual companies can be explained by stock...
-
Use the code shown in Figure 6-34 to answer What will the code in Figure 6-34 display when the id variable contains the number 9? a. Janet b. Jerry c. Mark d. Sue switch (id) { case 8: cout < <...
-
A program uses a char variable named department and two double variables named salary and raise. The department variable contains one of the following letters (entered in either uppercase or...
-
Follow the instructions for starting C++ and viewing the SwatTheBugs29.cpp file, which is contained in either the Cpp8\Chap07\SwatTheBugs29 Project folder or the Cpp8\ Chap07 folder. (You may need to...
-
On June 3, 2019, Catherine Shanahan received an unsolicited phone call on her cell phone. When she answered, she heard a prerecorded voice message advertising extended automobile warranties (Service...
-
John Whalen was employed by the City of Binghamton as the director of Parks and Recreation. In his capacity as the director, Whalen was to collect various fees and was entrusted with related funds....
-
On August 14, 2018, Jane Doe asked her boyfriend to call an Uber for her as Does phone had low battery. Does boyfriend was not with her, so she did not know which driver Uber had assigned to pick her...
Study smarter with the SolutionInn App