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...
-
Linda received $90,000 in salary income for 2016. She has no dependents. Determine her income tax liability under each of the following independent situations: a. She files as a single individual. b....
-
If f1(x) and f2(x) are functions from the set of positive integers to the set of positive real numbers and f1(x) and f2 (x) are both (g(x)), is (f1 f2)(x) also (g(x))? Either prove that it is or give...
-
Gorman Enterprises sells on account. When a customer account becomes four months old, Gorman converts the account to a note receivable. During 2010, Gorman completed these transactions: Requirement...
-
Family Supermarkets (FS) has a kaizen (continuous improvement) approach to budgeting monthly activity costs for each month of 2011. Each successive month, the budgeted cost-driver rate decreases by...
-
X-Sal-Ent Corp produces frozen dinners. The company has a policy that ending inventory of frozen dinners must be 30% of the following month's expected sales. Required: January February March Unit...
-
Which series has the highest beta. BraveNewCoin Liquid Index for Bitcoin 1D BNC Trading Brave Ne Yellow Green Blue Orange
-
If law represents society's standard of desirable behaviour, why are laws hotly debated, changed or disobeyed? Which laws do students frequently disobey and which laws would they never consider...
-
A band sells shirts and CDs at their concerts. They have 3 CDs and there are 4 different styles of shirt available in small, medium, large, and extra large. How many ways could someone buy two...
-
Microsoft has a bond that was issued two years ago. It has a par value of $3,000, the coupon rate of 9%, paid semiannually , and has 4 more years left until it matures. Its yield to maturity is 10%....
-
Timothy has $1,372 in the bank. He got $259 for his birthday. Timothy's older sister has 3 times as much money as Timothy. How much money does Timothy's sister have?
-
You would like to start saving for retirement. Assuming you are now 2 5 years old and want to retire at age 5 5 , you have 3 0 years to watch your investment grow. You decide to invest in the stock...
-
Swanston Enterprises report GST quarterly on a cash basis. They had the following account balances (on a cash basis) for the September quarter. All amounts include GST where applicable. ACCOUNT...
-
ABC Inc. expects to earn $4 per share next year and will pay out all of its income as dividends. Current share price is $25. What is equity cost of capital? If it chooses to reduce its payout rate to...
-
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...
-
Why is the mass matrix \([\mathrm{m}]\) always positive definite?
-
Express the potential and kinetic energies of an \(n\)-degree-of-freedom system, using matrix notation.
-
What is the difference between generalized coordinates and Cartesian coordinates?
Study smarter with the SolutionInn App