c***d 发帖数: 996 | 1 ☆─────────────────────────────────────☆
tennisalways (tennisforever) 于 (Sat Jan 20 11:31:12 2007) 提到:
Here is a function max(i,n) that returns the largest element in positions i
through i+n-1 of an integer array A. You may assume for convenience that n
is a power of 2.
function max (i,n: integer):integer;
var
m1,m2:integer;
begin
if n=1 then
return (A[i])
else begin
m1:=max(i, n div 2);
m2:=max(i + n div 2, n div 2);
|
|