1 (* Copyright (C) DooM 2D:Forever Developers
2 *
3 * This program is free software: you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation, either version 3 of the License, or
6 * (at your option) any later version.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 *)
16 {$INCLUDE a_modes.inc}
17 // binary heap
20 interface
23 type
24 // WARNING! don't put structures into heap, use ponters or ids!
26 private
27 type
30 private
35 private
38 public
53 type
62 implementation
64 uses
65 SysUtils;
68 // ////////////////////////////////////////////////////////////////////////// //
73 function binHeapNewIntLess (): TBinaryHeapInt; begin result := TBinaryHeapInt.Create(@intLess); end;
74 function binHeapNewIntGreat (): TBinaryHeapInt; begin result := TBinaryHeapInt.Create(@intGreat); end;
77 // ////////////////////////////////////////////////////////////////////////// //
79 begin
88 begin
95 begin
101 var
104 begin
106 begin
113 // swap
123 var
125 begin
126 //if (val = nil) then exit;
128 // grow?
130 begin
134 // increase counter
136 // insert element
138 begin
148 begin
154 begin
156 begin