bubble sort

Submit

Your name:
File:
Open code-statistics:

Language is selected by the extension of the file. See the list of supported languages to know the extension of your language.

Problem

Please sort it with the bubble sort in ascending order.
The first line is a number of elements.

Options

exec is denied

now post-mortem time, all source codes will be revealed

Sample input:_

5
36
87
98
18
43

Sample output:

compare =  1   swap =  0   data: 36 87 98 18 43
compare =  2   swap =  0   data: 36 87 98 18 43
compare =  3   swap =  1   data: 36 87 18 98 43
compare =  4   swap =  2   data: 36 87 18 43 98
compare =  5   swap =  2   data: 36 87 18 43 98
compare =  6   swap =  3   data: 36 18 87 43 98
compare =  7   swap =  4   data: 36 18 43 87 98
compare =  8   swap =  5   data: 18 36 43 87 98
compare =  9   swap =  5   data: 18 36 43 87 98
compare = 10   swap =  5   data: 18 36 43 87 98

Sample input:_

8
65
30
96
6
18
40
67
28

Sample output:

compare =  1   swap =  1   data: 30 65 96  6 18 40 67 28
compare =  2   swap =  1   data: 30 65 96  6 18 40 67 28
compare =  3   swap =  2   data: 30 65  6 96 18 40 67 28
compare =  4   swap =  3   data: 30 65  6 18 96 40 67 28
compare =  5   swap =  4   data: 30 65  6 18 40 96 67 28
compare =  6   swap =  5   data: 30 65  6 18 40 67 96 28
compare =  7   swap =  6   data: 30 65  6 18 40 67 28 96
compare =  8   swap =  6   data: 30 65  6 18 40 67 28 96
compare =  9   swap =  7   data: 30  6 65 18 40 67 28 96
compare = 10   swap =  8   data: 30  6 18 65 40 67 28 96
compare = 11   swap =  9   data: 30  6 18 40 65 67 28 96
compare = 12   swap =  9   data: 30  6 18 40 65 67 28 96
compare = 13   swap = 10   data: 30  6 18 40 65 28 67 96
compare = 14   swap = 11   data:  6 30 18 40 65 28 67 96
compare = 15   swap = 12   data:  6 18 30 40 65 28 67 96
compare = 16   swap = 12   data:  6 18 30 40 65 28 67 96
compare = 17   swap = 12   data:  6 18 30 40 65 28 67 96
compare = 18   swap = 13   data:  6 18 30 40 28 65 67 96
compare = 19   swap = 13   data:  6 18 30 40 28 65 67 96
compare = 20   swap = 13   data:  6 18 30 40 28 65 67 96
compare = 21   swap = 13   data:  6 18 30 40 28 65 67 96
compare = 22   swap = 14   data:  6 18 30 28 40 65 67 96
compare = 23   swap = 14   data:  6 18 30 28 40 65 67 96
compare = 24   swap = 14   data:  6 18 30 28 40 65 67 96
compare = 25   swap = 15   data:  6 18 28 30 40 65 67 96
compare = 26   swap = 15   data:  6 18 28 30 40 65 67 96
compare = 27   swap = 15   data:  6 18 28 30 40 65 67 96
compare = 28   swap = 15   data:  6 18 28 30 40 65 67 96

Sample input:_

14
28
78
69
22
54
18
79
85
64
38
27
57
1
13

Sample output:

compare =  1   swap =  0   data: 28 78 69 22 54 18 79 85 64 38 27 57  1 13
compare =  2   swap =  1   data: 28 69 78 22 54 18 79 85 64 38 27 57  1 13
compare =  3   swap =  2   data: 28 69 22 78 54 18 79 85 64 38 27 57  1 13
compare =  4   swap =  3   data: 28 69 22 54 78 18 79 85 64 38 27 57  1 13
compare =  5   swap =  4   data: 28 69 22 54 18 78 79 85 64 38 27 57  1 13
compare =  6   swap =  4   data: 28 69 22 54 18 78 79 85 64 38 27 57  1 13
compare =  7   swap =  4   data: 28 69 22 54 18 78 79 85 64 38 27 57  1 13
compare =  8   swap =  5   data: 28 69 22 54 18 78 79 64 85 38 27 57  1 13
compare =  9   swap =  6   data: 28 69 22 54 18 78 79 64 38 85 27 57  1 13
compare = 10   swap =  7   data: 28 69 22 54 18 78 79 64 38 27 85 57  1 13
compare = 11   swap =  8   data: 28 69 22 54 18 78 79 64 38 27 57 85  1 13
compare = 12   swap =  9   data: 28 69 22 54 18 78 79 64 38 27 57  1 85 13
compare = 13   swap = 10   data: 28 69 22 54 18 78 79 64 38 27 57  1 13 85
compare = 14   swap = 10   data: 28 69 22 54 18 78 79 64 38 27 57  1 13 85
compare = 15   swap = 11   data: 28 22 69 54 18 78 79 64 38 27 57  1 13 85
compare = 16   swap = 12   data: 28 22 54 69 18 78 79 64 38 27 57  1 13 85
compare = 17   swap = 13   data: 28 22 54 18 69 78 79 64 38 27 57  1 13 85
compare = 18   swap = 13   data: 28 22 54 18 69 78 79 64 38 27 57  1 13 85
compare = 19   swap = 13   data: 28 22 54 18 69 78 79 64 38 27 57  1 13 85
compare = 20   swap = 14   data: 28 22 54 18 69 78 64 79 38 27 57  1 13 85
compare = 21   swap = 15   data: 28 22 54 18 69 78 64 38 79 27 57  1 13 85
compare = 22   swap = 16   data: 28 22 54 18 69 78 64 38 27 79 57  1 13 85
compare = 23   swap = 17   data: 28 22 54 18 69 78 64 38 27 57 79  1 13 85
compare = 24   swap = 18   data: 28 22 54 18 69 78 64 38 27 57  1 79 13 85
compare = 25   swap = 19   data: 28 22 54 18 69 78 64 38 27 57  1 13 79 85
compare = 26   swap = 20   data: 22 28 54 18 69 78 64 38 27 57  1 13 79 85
compare = 27   swap = 20   data: 22 28 54 18 69 78 64 38 27 57  1 13 79 85
compare = 28   swap = 21   data: 22 28 18 54 69 78 64 38 27 57  1 13 79 85
compare = 29   swap = 21   data: 22 28 18 54 69 78 64 38 27 57  1 13 79 85
compare = 30   swap = 21   data: 22 28 18 54 69 78 64 38 27 57  1 13 79 85
compare = 31   swap = 22   data: 22 28 18 54 69 64 78 38 27 57  1 13 79 85
compare = 32   swap = 23   data: 22 28 18 54 69 64 38 78 27 57  1 13 79 85
compare = 33   swap = 24   data: 22 28 18 54 69 64 38 27 78 57  1 13 79 85
compare = 34   swap = 25   data: 22 28 18 54 69 64 38 27 57 78  1 13 79 85
compare = 35   swap = 26   data: 22 28 18 54 69 64 38 27 57  1 78 13 79 85
compare = 36   swap = 27   data: 22 28 18 54 69 64 38 27 57  1 13 78 79 85
compare = 37   swap = 27   data: 22 28 18 54 69 64 38 27 57  1 13 78 79 85
compare = 38   swap = 28   data: 22 18 28 54 69 64 38 27 57  1 13 78 79 85
compare = 39   swap = 28   data: 22 18 28 54 69 64 38 27 57  1 13 78 79 85
compare = 40   swap = 28   data: 22 18 28 54 69 64 38 27 57  1 13 78 79 85
compare = 41   swap = 29   data: 22 18 28 54 64 69 38 27 57  1 13 78 79 85
compare = 42   swap = 30   data: 22 18 28 54 64 38 69 27 57  1 13 78 79 85
compare = 43   swap = 31   data: 22 18 28 54 64 38 27 69 57  1 13 78 79 85
compare = 44   swap = 32   data: 22 18 28 54 64 38 27 57 69  1 13 78 79 85
compare = 45   swap = 33   data: 22 18 28 54 64 38 27 57  1 69 13 78 79 85
compare = 46   swap = 34   data: 22 18 28 54 64 38 27 57  1 13 69 78 79 85
compare = 47   swap = 35   data: 18 22 28 54 64 38 27 57  1 13 69 78 79 85
compare = 48   swap = 35   data: 18 22 28 54 64 38 27 57  1 13 69 78 79 85
compare = 49   swap = 35   data: 18 22 28 54 64 38 27 57  1 13 69 78 79 85
compare = 50   swap = 35   data: 18 22 28 54 64 38 27 57  1 13 69 78 79 85
compare = 51   swap = 36   data: 18 22 28 54 38 64 27 57  1 13 69 78 79 85
compare = 52   swap = 37   data: 18 22 28 54 38 27 64 57  1 13 69 78 79 85
compare = 53   swap = 38   data: 18 22 28 54 38 27 57 64  1 13 69 78 79 85
compare = 54   swap = 39   data: 18 22 28 54 38 27 57  1 64 13 69 78 79 85
compare = 55   swap = 40   data: 18 22 28 54 38 27 57  1 13 64 69 78 79 85
compare = 56   swap = 40   data: 18 22 28 54 38 27 57  1 13 64 69 78 79 85
compare = 57   swap = 40   data: 18 22 28 54 38 27 57  1 13 64 69 78 79 85
compare = 58   swap = 40   data: 18 22 28 54 38 27 57  1 13 64 69 78 79 85
compare = 59   swap = 41   data: 18 22 28 38 54 27 57  1 13 64 69 78 79 85
compare = 60   swap = 42   data: 18 22 28 38 27 54 57  1 13 64 69 78 79 85
compare = 61   swap = 42   data: 18 22 28 38 27 54 57  1 13 64 69 78 79 85
compare = 62   swap = 43   data: 18 22 28 38 27 54  1 57 13 64 69 78 79 85
compare = 63   swap = 44   data: 18 22 28 38 27 54  1 13 57 64 69 78 79 85
compare = 64   swap = 44   data: 18 22 28 38 27 54  1 13 57 64 69 78 79 85
compare = 65   swap = 44   data: 18 22 28 38 27 54  1 13 57 64 69 78 79 85
compare = 66   swap = 44   data: 18 22 28 38 27 54  1 13 57 64 69 78 79 85
compare = 67   swap = 45   data: 18 22 28 27 38 54  1 13 57 64 69 78 79 85
compare = 68   swap = 45   data: 18 22 28 27 38 54  1 13 57 64 69 78 79 85
compare = 69   swap = 46   data: 18 22 28 27 38  1 54 13 57 64 69 78 79 85
compare = 70   swap = 47   data: 18 22 28 27 38  1 13 54 57 64 69 78 79 85
compare = 71   swap = 47   data: 18 22 28 27 38  1 13 54 57 64 69 78 79 85
compare = 72   swap = 47   data: 18 22 28 27 38  1 13 54 57 64 69 78 79 85
compare = 73   swap = 48   data: 18 22 27 28 38  1 13 54 57 64 69 78 79 85
compare = 74   swap = 48   data: 18 22 27 28 38  1 13 54 57 64 69 78 79 85
compare = 75   swap = 49   data: 18 22 27 28  1 38 13 54 57 64 69 78 79 85
compare = 76   swap = 50   data: 18 22 27 28  1 13 38 54 57 64 69 78 79 85
compare = 77   swap = 50   data: 18 22 27 28  1 13 38 54 57 64 69 78 79 85
compare = 78   swap = 50   data: 18 22 27 28  1 13 38 54 57 64 69 78 79 85
compare = 79   swap = 50   data: 18 22 27 28  1 13 38 54 57 64 69 78 79 85
compare = 80   swap = 51   data: 18 22 27  1 28 13 38 54 57 64 69 78 79 85
compare = 81   swap = 52   data: 18 22 27  1 13 28 38 54 57 64 69 78 79 85
compare = 82   swap = 52   data: 18 22 27  1 13 28 38 54 57 64 69 78 79 85
compare = 83   swap = 52   data: 18 22 27  1 13 28 38 54 57 64 69 78 79 85
compare = 84   swap = 53   data: 18 22  1 27 13 28 38 54 57 64 69 78 79 85
compare = 85   swap = 54   data: 18 22  1 13 27 28 38 54 57 64 69 78 79 85
compare = 86   swap = 54   data: 18 22  1 13 27 28 38 54 57 64 69 78 79 85
compare = 87   swap = 55   data: 18  1 22 13 27 28 38 54 57 64 69 78 79 85
compare = 88   swap = 56   data: 18  1 13 22 27 28 38 54 57 64 69 78 79 85
compare = 89   swap = 57   data:  1 18 13 22 27 28 38 54 57 64 69 78 79 85
compare = 90   swap = 58   data:  1 13 18 22 27 28 38 54 57 64 69 78 79 85
compare = 91   swap = 58   data:  1 13 18 22 27 28 38 54 57 64 69 78 79 85

Ranking

Ruby _

RankUserSizeTimeDateStatistics
1ksk1350.12042008/11/25 01:14:450B / 57B / 67B
2leonid1370.06602008/11/24 08:45:460B / 67B / 58B
3murky-satyr1420.06462008/11/24 20:30:240B / 69B / 61B
4yowa1450.05662008/11/25 01:56:520B / 68B / 65B
5mokos1570.09872008/11/30 02:16:080B / 76B / 69B
6eban1720.07362008/11/25 18:14:010B / 82B / 71B
7tabasa1920.07052008/11/25 05:18:070B / ?B / ?B
8murky-satyr1350.11652008/12/03 06:17:010B / 67B / 56B

Perl _

RankUserSizeTimeDateStatistics
1ySas1330.04482008/11/24 21:56:030B / ?B / ?B
2Mithran1330.03772008/11/28 12:05:060B / 36B / 89B

Python _

RankUserSizeTimeDateStatistics
1kt3k1830.21732008/11/24 07:37:540B / 99B / 62B
2recursive1910.10522008/12/31 05:23:310B / 101B / 69B

PHP _

RankUserSizeTimeDateStatistics
1o-cn1800.02242009/12/26 03:16:51108B / ?B / ?B

Common LISP _

RankUserSizeTimeDateStatistics
1kozima2131.99342008/11/26 09:14:020B / 115B / 65B
2kozima2061.28902008/12/01 13:55:300B / 115B / 63B

Io _

RankUserSizeTimeDateStatistics
1murky-satyr2151.36272008/11/26 03:53:480B / 132B / 67B
2pooq2781.18752008/11/25 21:06:390B / 168B / 82B

JavaScript _

RankUserSizeTimeDateStatistics
1nn1830.05742008/11/24 23:40:570B / 85B / 90B
2murky-satyr1830.12492008/11/26 03:43:150B / 81B / 97B
3nn1790.13892008/12/01 23:16:040B / 78B / 96B

Lua _

RankUserSizeTimeDateStatistics
1murky-satyr2270.04192008/11/24 22:30:210B / 127B / 73B

BASIC _

RankUserSizeTimeDateStatistics
1pooq2260.43632008/11/25 21:59:380B / 124B / 67B

J _

RankUserSizeTimeDateStatistics
1pooq2040.27732008/11/29 14:48:390B / 85B / 97B
2pooq1950.14772011/01/30 08:54:550B / 83B / 91B

C _

RankUserSizeTimeDateStatistics
151b2050.04362008/11/24 19:53:020B / 96B / 101B
2Purika2420.08102008/11/30 04:48:180B / ?B / ?B
3mazun2470.12702008/11/30 03:08:420B / 119B / 120B
451b2040.10082009/01/18 22:25:480B / 96B / 100B
5inaniwa3810.00142009/12/16 17:02:4719B / 126B / 129B

D _

RankUserSizeTimeDateStatistics
151b2400.05142009/01/18 22:24:030B / 123B / 106B

OCaml _

RankUserSizeTimeDateStatistics
1ksk2480.70242008/11/29 00:59:360B / 135B / 92B

Haskell _

RankUserSizeTimeDateStatistics
1notogawa2480.08532008/11/29 23:59:290B / ?B / ?B

Pascal _

RankUserSizeTimeDateStatistics
1uru2920.27512009/07/27 23:47:240B / 178B / 90B

Fortran _

RankUserSizeTimeDateStatistics
1pooq2130.06462008/11/29 13:06:030B / 119B / 69B

Maxima _

RankUserSizeTimeDateStatistics
1pooq2170.84922009/03/07 12:47:310B / 119B / 72B

AWK _

RankUserSizeTimeDateStatistics
1nn1620.13882008/11/25 18:51:450B / 76B / 72B
2nn1600.03962009/08/25 00:28:070B / 76B / 72B

sed _

RankUserSizeTimeDateStatistics
1emoken4740.09432008/11/25 18:22:550B / 147B / 251B

Postscript _

RankUserSizeTimeDateStatistics
1ySas1651.20962008/12/01 01:15:0747B / ?B / ?B
2yshl(bin)1661.34382008/11/25 01:06:0862B / 62B / 27B
3yshl2481.14632008/11/25 01:05:580B / 161B / 41B
4ySas (no bin)2921.28902008/12/01 01:43:120B / 205B / 35B
5yshl(bin)1601.48852008/12/06 17:50:4358B / 60B / 27B

R _

RankUserSizeTimeDateStatistics
1pooq2254.28872008/11/29 13:39:060B / 115B / 91B

goruby _

RankUserSizeTimeDateStatistics
1murky-satyr1240.27862008/11/25 01:23:590B / 59B / 53B
2murky-satyr1180.09882009/12/22 15:24:150B / 54B / 53B

Groovy _

RankUserSizeTimeDateStatistics
1murky-satyr1703.63542010/01/03 05:01:320B / 89B / 71B
2nn2127.38332009/11/07 00:25:080B / 104B / 91B

Language Ranking_

RankLangUserSizeScore
1gorubymurky-satyr11810000
2PerlySas1338872
3Rubyksk1358740
4Postscriptyshl(bin)1607375
5AWKnn1607375
6Groovymurky-satyr1706941
7JavaScriptnn1796592
8PHPo-cn1806555
9Pythonkt3k1836448
10Jpooq1956051
11C51b2045784
12Common LISPkozima2065728
13Fortranpooq2135539
14Iomurky-satyr2155488
15Maximapooq2175437
16Rpooq2255244
17BASICpooq2265221
18Luamurky-satyr2275198
19D51b2404916
20OCamlksk2484758
21Haskellnotogawa2484758
22Pascaluru2924041
23sedemoken4742489

return top