Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void SapXep(int a[], int n)
- {
- for (int i=0;i<n;i++)
- for (int j = i+1; j < n; j++)
- {
- if (a[i] > a[j]) swap(a[i], a[j]);
- }
- }
- int DemSoLan(int a[], int n)
- {
- int dem = 1;
- for (int i = 0; i < n; i++)
- {
- if (a[i] == a[i + 1])
- {
- dem++;
- }
- else if (a[i] != a[i + 1])
- {
- cout << "so lan xuat hien cua " << a[i] << " la: " << dem << endl;
- dem = 1;
- }
- }
- return dem;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement