diff options
| author | Mohammad S Anwar <Mohammad.Anwar@yahoo.com> | 2020-10-25 17:11:13 +0000 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-10-25 17:11:13 +0000 |
| commit | c2f5db7f256445ded6bb85961b897086c8683088 (patch) | |
| tree | 72f1d947fd7928ae4aaaa1f761605044eea4ff21 /challenge-083 | |
| parent | b36b174c1a2554b2b64470ce46c2e937ce7bfbd6 (diff) | |
| parent | 9e41b4ed9478e0c2feb163723045e94698aacd81 (diff) | |
| download | perlweeklychallenge-club-c2f5db7f256445ded6bb85961b897086c8683088.tar.gz perlweeklychallenge-club-c2f5db7f256445ded6bb85961b897086c8683088.tar.bz2 perlweeklychallenge-club-c2f5db7f256445ded6bb85961b897086c8683088.zip | |
Merge pull request #2609 from ddobbelaere/solution-083-final-things
Solution 083 final things
Diffstat (limited to 'challenge-083')
| -rw-r--r-- | challenge-083/ddobbelaere/blog.txt | 1 | ||||
| -rw-r--r-- | challenge-083/ddobbelaere/perl/ch-2.pl | 8 |
2 files changed, 6 insertions, 3 deletions
diff --git a/challenge-083/ddobbelaere/blog.txt b/challenge-083/ddobbelaere/blog.txt new file mode 100644 index 0000000000..777057f38f --- /dev/null +++ b/challenge-083/ddobbelaere/blog.txt @@ -0,0 +1 @@ +https://magneticcharge.wordpress.com/2020/10/25/perl-weekly-challenge-083/
\ No newline at end of file diff --git a/challenge-083/ddobbelaere/perl/ch-2.pl b/challenge-083/ddobbelaere/perl/ch-2.pl index 782093463b..b17ffa69ae 100644 --- a/challenge-083/ddobbelaere/perl/ch-2.pl +++ b/challenge-083/ddobbelaere/perl/ch-2.pl @@ -14,9 +14,11 @@ Given an array of positive elements, you have to flip the sign of some of its el use v5.30; use warnings; -# Note: this naive implementation has exponential time complexity (as a function of input vector length)! -# For a more efficient implementation, see https://www.ijcai.org/Proceedings/09/Papers/096.pdf and https://en.wikipedia.org/wiki/Karmarkar%27s_algorithm. -# Also note that multiple solutions might exist, but in that case only one possible answer is returned. +# Note: this naive implementation has exponential time complexity (in terms of the list length)! +# For heuristic algorithms with lower average running time, see https://www.ijcai.org/Proceedings/09/Papers/096.pdf. +# However, note that even those have worst case exponential time complexity (in terms of the list length). +# +# Also note that multiple solutions might exist, but in that case only one possible solution is returned. sub flip_count_minimum_non_negative { my @A = @_; |
