🔒 Closed Output help

Status
Not open for further replies.

LuffyD14

Leecher
Analyze 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. (35 pts)

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]);

}
 
Status
Not open for further replies.

About this Thread

  • 0
    Replies
  • 446
    Views
  • 1
    Participants
Last reply from:
LuffyD14

Trending Topics

Online now

Members online
357
Guests online
1,279
Total visitors
1,636

Forum statistics

Threads
2,292,900
Posts
29,080,055
Members
1,209,577
Latest member
yasssx67
Back
Top