- 1
Bubble sort
#include <iostream> using namespace std; int main() { int n; cin>>n; int arr[n]; for(int i=0;i<n;i++){ cin>>arr[i]; } int counter=1; while(counter<n){ for(int i=0;i<n-counter;i++){ if(arr[i]>arr[i+1]){ int temp=arr[i+1]; arr[i+1]=temp; } } counter++; } for(int i=0;i<n;i++){ cout<<arr[i]<<" "; } return 0; }
3 ответов
+ 1
The output is incorrect
0
I dont see no problems with that :3
0
I know I said that being sarcastic. Also surprised this all happened in one day. People arn't usually active on this app unless in a class.