🔒 Closed C problem help

Status
Not open for further replies.

BlacksheepHD

Eternal Poster
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
  • 436
    Views
  • 1
    Participants
Last reply from:
BlacksheepHD

Trending Topics

Online now

Members online
1,305
Guests online
3,504
Total visitors
4,809

Forum statistics

Threads
2,308,434
Posts
29,185,086
Members
1,191,992
Latest member
flflchch
Back
Top