Pure Bubble Sort - Hackerrank Problem Solution

Pure Bubble Sort

Hackerrank Problem Solution



PROBLEM STATEMENT

Input Format

The first line contains an integer, n , the size of the array

The second line contains n space-separated integers a[i].

Constraints

2

Output Format

You must print the following three lines of output:

  1. Array is sorted and printed in ascending order
  2. Total number of comparisons
  3. Total number of swaps.

Sample Input 0

3
1 2 3

Sample Output 0

1 2 3
2
0




SOLUTION
SHARE If you find this useful, please share with your friends and Community.
CODE TOGETHER..GROW TOGETHER.
Newer Posts Newer Posts Older Posts Older Posts

More posts

Comments

Post a Comment

Sponsored Content