折半查找
function GetNodeUseXxh(const List: TList; const XXH: Integer):
pCommonXXHandListNode;
//使用折半法查找节点
var
Low, High, Mid: Integer;
pnode: pCommonXXHandListNode;
begin
Result := nil;
Low := 0;
High := List.count - 1;
while (Low <= High) do
begin
Mid := (Low
+ High) div 2;
pnode :=
pCommonXXHandListNode(List.Items[Mid]);
if
pnode^.XXH = XXH then begin
Result := pnode;
Break;
end
else if
pnode^.XXH > XXH then begin
High := Mid - 1;
end
else
Low := Mid + 1;
end;
end;