Closest-pair problem: Difference between revisions
Content deleted Content added
Line 211: | Line 211: | ||
=={{header|D}}== |
=={{header|D}}== |
||
D version 2 implementation, |
D version 2 implementation, designed for compactness: |
||
<lang d>import std.stdio,std.typecons,std.math,std.algorithm,std.array,std.random; |
<lang d>import std.stdio,std.typecons,std.math,std.algorithm,std.array,std.random; |
||
Line 288: | Line 288: | ||
Time gave 0:06.28 elapsed for brute force, and 0:00.07 elapsed for the divide & conquer one (10_000 points). |
Time gave 0:06.28 elapsed for brute force, and 0:00.07 elapsed for the divide & conquer one (10_000 points). |
||
A |
A more efficient implementation of the brute-force algorithm: |
||
<lang d>import std.stdio, std.typecons, std.math, std.random; |
<lang d>import std.stdio, std.typecons, std.math, std.random; |
||