Bubble Sort Given an array of integers, sort the array in ascending/descending order by using bubble sort algorithm. Ref
-
- Site Admin
- Posts: 899603
- Joined: Mon Aug 02, 2021 8:13 am
Bubble Sort Given an array of integers, sort the array in ascending/descending order by using bubble sort algorithm. Ref
http://www.algolist.net/Algorithms/Sorting/Bubble_sort Write a program to accept 3 parameters, an array A of integers, size of the array N and sorting order 0 (0 or 1). Note: 0 represents ascending order. 1 represents descending order. Input 0 9 436892157 Where, • First line represents the type of ordering. • Second line represents the size of the array. • Third line represents array elements. Output 123456789 + Test Case(s) + Grading Criteria solution.cpp + Add Custom Test Case ↑ solution.cpp 1 #include<iostream> 2 #include<cstdio> 3 using namespace std; 4 5 class ProblemSolution{ }; 6 7 8 9 10 int ProblemSolution :: solution(int A[], int N) 11. { 12 public: 13 } 14 int solution (int A[], int N); //write your code here 15 //Your program will be evaluated by this main method and several test cases. 16 int main() 17 { 18 19 20 ▾ 21 22 23 24 25 26 27 } int N; cin >> N; int A[N]; for(int i=0; i<n; i++) { } cin >> A; ProblemSolution problemSolution; cout << problem Solution.solution (A,N); I Compiler: CPP (gcc-8.x) RUN
Bubble Sort Given an array of integers, sort the array in ascending/descending order by using bubble sort algorithm. Reference: