Answered You can hire a professional tutor to get the answer.

QUESTION

Question: Given an array int a[5] = {9, 3, 22, 8, 1}, sort array a by assembly program. The following is code to sort array a in c++ using bubble...

Question:

Given an array int a[5] = {9, 3, 22, 8, 1}, sort array a by assembly program. The following is code to sort array a in c++ using bubble sort, translate the c++ code to assembly language.

void swap(int a, int b){

int temp;

temp = a;

a = b;

b = temp;

}

void Bsort(int a[] , int b){

for(i < 0; i< n-1; ++i){

for(int j = 0; j < n-i-1; ++j){

if(a[j] > a[j+1]){

swap(a[j], a[j+1]);

}

}

}

}

sample I/O

Orignal array a: 9 3 22 8 1

Sorted array a: 1 3 8 9 22

My code is here, I have a skeleton but don't know how to complete. Thanks so much! 

#include

Show more
LEARN MORE EFFECTIVELY AND GET BETTER GRADES!
Ask a Question