1,475 views
0 0 votes
Write a bubble sort code which should work for any array size up to the memory limit. The program should print the output using a different function, and also must print the number of swaps which took place. Run the code for input sizes, 500, 50000 and 500000 -- for best, approximately average and worst cases.

-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

why rand() should be used in average and worst cases? If without rand() we implement it ,what will be disadvantage

Please log in or register to answer this question.

Position:
Show:

Related questions

5 5 votes
2 2 answers
341
341 views
GO Classes asked Jun 30
341 views
What is the output of the following code?#include <stdio.h struct Book { char name[4]; int pages; }; int main() { struct Book b1 = {"CAT", 50}; struct Book b2; b2 = b1; b...
0 0 votes
1 1 answer
1.1k
1.1k views
Lakshman Bhaiya asked Apr 22, 2018
1,060 views
Q)What is the output of the following program segment#include<stdio.h>int main(){char a = 7 ; a ^ = 5 ;printf( "%d", printf( "%d", a + = 3 ) ) ;return 0;} A) 5 B...
0 0 votes
1 1 answer
1.1k
1.1k views
Arun Rout asked Feb 28, 2019
1,112 views
Following C program is written to find the pairs of elements in an array whose sum is 9.The for loop will iterate over the array of size 7.The program will print the corr...
0 0 votes
0 0 answers
446
446 views
balaganesh asked Aug 31, 2018
446 views
the output of the following problem?main(){ int a=1,b=2,c=4; printf("%d",a+=(a+=4,10,a));} Explain?