| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package Acme::ICan::tBelieveItCanSort { |
|
2
|
2
|
|
|
2
|
|
62463
|
use 5.016000; |
|
|
2
|
|
|
|
|
16
|
|
|
3
|
2
|
|
|
2
|
|
8
|
use strict; |
|
|
2
|
|
|
|
|
4
|
|
|
|
2
|
|
|
|
|
37
|
|
|
4
|
2
|
|
|
2
|
|
7
|
use warnings; |
|
|
2
|
|
|
|
|
3
|
|
|
|
2
|
|
|
|
|
300
|
|
|
5
|
|
|
|
|
|
|
our $VERSION = "0.01"; |
|
6
|
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
package Acme::ICan { |
|
8
|
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
sub tBelieveItCanSort (@) { |
|
10
|
2
|
|
|
2
|
|
123
|
my @A = @_; |
|
11
|
2
|
|
|
|
|
7
|
for my $i ( 0 .. $#A ) { |
|
12
|
15
|
|
|
|
|
23
|
for my $j ( 0 .. $#A ) { |
|
13
|
125
|
100
|
|
|
|
190
|
if ( $A[$i] < $A[$j] ) { |
|
14
|
27
|
|
|
|
|
38
|
@A[ $i, $j ] = @A[ $j, $i ]; |
|
15
|
|
|
|
|
|
|
} |
|
16
|
|
|
|
|
|
|
} |
|
17
|
|
|
|
|
|
|
} |
|
18
|
2
|
|
|
|
|
15
|
@A; |
|
19
|
|
|
|
|
|
|
} |
|
20
|
|
|
|
|
|
|
} |
|
21
|
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
=pod |
|
23
|
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
=encoding utf-8 |
|
25
|
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
=head1 NAME |
|
27
|
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
Acme::ICan'tBelieveItCanSort - Wait... It Actually Works? |
|
29
|
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
=head1 SYNOPSIS |
|
31
|
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
use Acme::ICan'tBelieveItCanSort; |
|
33
|
|
|
|
|
|
|
Acme::ICan'tBelieveItCanSort( 3, 4, 5, 5, 68, 1, 4, 321, 32, 321 ); |
|
34
|
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
=head1 DESCRIPTION |
|
36
|
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
Acme::ICan'tBelieveItCanSort is a pure Perl implementation of "the simplest |
|
38
|
|
|
|
|
|
|
(and most surprising) sorting algorithm ever" as described by Stanley P. Y. |
|
39
|
|
|
|
|
|
|
Fung: |
|
40
|
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
We present an extremely simple sorting algorithm. It may look like it is |
|
42
|
|
|
|
|
|
|
obviously wrong, but we prove that it is in fact correct. We compare it with |
|
43
|
|
|
|
|
|
|
other simple sorting algorithms, and analyse some of its curious properties. |
|
44
|
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
This module itself is named after L<< C
|
|
46
|
|
|
|
|
|
|
1>|https://arxiv.org/pdf/2110.01111.pdf >>. |
|
47
|
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
=head1 See Also |
|
49
|
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
=over |
|
51
|
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
=item "Is this the simplest (and most surprising) sorting algorithm ever?" |
|
53
|
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
Stanley P. Y. Fung, https://arxiv.org/abs/2110.01111 |
|
55
|
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
=item https://github.com/mattn/i_cant_believe_it_can |
|
57
|
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
=item https://github.com/theshteves/simplest-sort |
|
59
|
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
=item https://github.com/PCBoyGames/ArrayV-v4.0/blob/main/src/sorts/exchange/UnbelievableSort.java |
|
61
|
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
=item https://github.com/jefflunt/unbelievable-sort |
|
63
|
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
=back |
|
65
|
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
=head1 LICENSE |
|
67
|
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
Copyright (C) Sanko Robinson. |
|
69
|
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
This library is free software; you can redistribute it and/or modify it under |
|
71
|
|
|
|
|
|
|
the terms found in the Artistic License 2. Other copyrights, terms, and |
|
72
|
|
|
|
|
|
|
conditions may apply to data transmitted through this module. |
|
73
|
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
=head1 AUTHOR |
|
75
|
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
Sanko Robinson Esanko@cpan.orgE |
|
77
|
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
=begin stopwords |
|
79
|
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
Acme::ICan'tBelieveItCanSort |
|
81
|
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
=end stopwords |
|
83
|
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
=cut |
|
85
|
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
}; |
|
87
|
|
|
|
|
|
|
1 |