The Guttman-Rosler Transform is a technique from Uri Guttman and Larry Rosler for improving sort speed in perl.……【阅读全文】
Tag Archives: 算法
在Perl中高效sort——Schwartzian变换
In computer science, the Schwartzian transform is a Perl programming idiom used to improve the efficiency of sorting a list of items. This idiom is appropriate for comparison-based sorting when the ordering is actually based on the ordering of a certain property (the key) of the elements, where computing that property is an intensive operation that should be performed a minimal number of times. The Schwartzian Transform is notable in that it does not use named temporary arrays.……【阅读全文】
在Perl中高效sort——Orcish算法
The Orcish Maneuver (invented by Joseph N. Hall [8]) eliminates the preprocessing pass over the data, which might save keeping a copy of the data if they are being read directly from a file. It does the sortkey extraction only once per record, as it checks the hash to see if it was done before. The test and storage of the sortkey is done with the ||= operator (short-circuit or-assignment), which will evaluate and assign the expression on the right to the lvalue on the left, if the lvalue is false. The name “orcish” is a pun on “or-cache”. The full statement in the sortsub looks like this:……【阅读全文】
从文本文件中随机抽提一行的方法
-
使用高德纳的算法
ec314a18394ff68ca357af957970a6a8004……【阅读全文】