Bubble Sort
Practice
3.1 (76 votes)
Algorithms
Basic programming
Bubble sort
Input/output
Sorting
Problem
86% Success 24322 Attempts 20 Points 1s Time Limit 256MB Memory 1024 KB Max Code

You are given arrays \(a_1, a_2, …, a_n\). What will return the next function \(Bubble\ Sort\ (A)\) in the next picture.

Link to the image: https://ibb.co/vzFR5kr

Input format

  • The first line contains the integer \(N\) (\(1 ⩽ N ⩽ 5000\)) denoting the number of elements of array \(A\).
  • The second line contains \(N\) positive integers (\(1 ⩽ A_i ⩽ N\)) denoting the elements of the array.
    Note: It is guaranteed that all elements of array \(A\) are different.

Output format

Print an integer that denotes the answer to the question.

Please login to use the editor

You need to be logged in to access the code editor

Loading...

Please wait while we load the editor

Loading...
Results
Custom Input
Run your code to see the output
Submissions
Please login to view your submissions
Similar Problems
Points:20
137 votes
Tags:
Ad-HocEasySorting
Points:20
49 votes
Tags:
AlgorithmsBubble sort algorithmEasySearchingSorting
Points:20
81 votes
Tags:
Basic ProgrammingBrute-force searchBubble sort algorithmEasySorting