๐Ÿ”’ 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
  • 441
    Views
  • 1
    Participants
Last reply from:
LuffyD14

Online now

Members online
831
Guests online
900
Total visitors
1,731

Forum statistics

Threads
2,276,095
Posts
28,967,564
Members
1,231,118
Latest member
czardinas
Back
Top