793 views
0 votes
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.

Related questions

0 votes
0 votes
1 answer
1
Lakshman Bhaiya asked Apr 22, 2018
623 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 votes
0 votes
0 answers
3
balaganesh asked Aug 31, 2018
225 views
the output of the following problem?main(){ int a=1,b=2,c=4; printf("%d",a+=(a+=4,10,a));} Explain?
2 votes
2 votes
1 answer
4
Prayag asked Jul 16, 2018
440 views
#include <stdio.h void f(char ); int main() { char *argv[] = { "ab", "cd", "ef", "gh", "ij", "kl" }; f(argv); return 0; } void f(char p) { char *t; t...