🔒 Closed C problem help

Status
Not open for further replies.

BlacksheepHD

Established
nalyze the program below and fill the output order on each loop on each pass given int a[]={7,3,66,3,-5,22,-77,2} as initial data order.

void swap(int *p, int *q)

{

int tmp;


tmp = *p;

*p = *q;

*q = tmp;

}

void bubble(int a[], int n)

{

int i, j;

for(i = 0 ; i < n – 1 ; i++)

for(j = n – 1 ; i < j ; j--)

if(a[j – 1] > a[j])

swap(&a[j – 1], &a[j]);

}


Given the code above please provide the final output below.
 
Status
Not open for further replies.

Similar threads

About this Thread

  • 0
    Replies
  • 432
    Views
  • 1
    Participants
Last reply from:
BlacksheepHD

Trending Topics

Online now

Members online
1,083
Guests online
1,368
Total visitors
2,451

Forum statistics

Threads
2,292,996
Posts
29,080,638
Members
1,208,626
Latest member
Ronchester_03
Back
Top