bubble sort

4
Bubble sort #include<conio.h> #include<iostream.h> template<class bubble> void bubble(bubble a[], int n) { int i, j; for(i!;i<n" ;i$$) { for(ji$ ;j<n;j$$) { if(a[i]>a[j]) { bubble element; element a[i]; a[i] a[j]; a[j] element; % % %% void main() { int a[&]{ ,', , , , %; char b[ ]{*s*,*b*,*d*,*e*%; clrscr(); bubble(a,&); cout<<+ n-orted rder /nte0ers1 +; for(int i!;i<&;i$$) cout<<a[i]<<+ t+; bubble(b, ); cout<<+ n-orted rder 2haracters1 +; for(int j!;j< ;j$$) cout<<b[j]<<+ t+; 0etch(); % Output:

Upload: shawn-rodriguez

Post on 05-Oct-2015

214 views

Category:

Documents


0 download

DESCRIPTION

hdfh

TRANSCRIPT

Bubble sort#include#includetemplatevoid bubble(bubble a[], int n){int i, j;for(i=0;i