- 1
Help me
How do I find worst case and best, average case #include<iostream> using namespace std; int main() { int a[5] = {34, 28, 1, 2, 65}; int i,j,b; for(i = 0; i < 5; i++){ cout<<a[i]<<"\t"; } cout<<"\n"; for( i = 1; i < 5; i++){ for(j = 0; j < (5-i); j++){ if( a[j] > a[j+1] ){ b = a[j]; a[j] = a[j+1]; a[j+1] = b; } } } for(j = 0; j < 5; j++){ cout<<a[j]<<"\t"; } return 0; }
2 Answers
+ 6
Bayan , you need to explain what your code is going to do. also saying "help me" is not sufficient. please explain clearly what your problem is. thanks!
+ 2
lets start: what language are you using here? looks like C, or maybe a C derivative. is that correct?



