[Overview][Types][Classes][Variables][Index] |
[Properties (by Name)] [Methods (by Name)] [Events (by Name)]
AVL tree component
Source position: avl_tree.pp line 81
type TAVLTree = class |
||
public |
||
constructor Create(); |
|
Create a new instance of TAVLTree |
constructor CreateObjectCompare(); |
|
Create an instance of the tree with extended compare method |
destructor Destroy; override; |
|
Destroy the TAVLTree instance |
property OnCompare: TListSortCompare; [rw] |
|
Compare function used when comparing nodes |
property OnObjectCompare: TObjectSortCompare; [rw] |
|
Compare handler |
property NodeClass: TAVLTreeNodeClass; [rw] |
|
Node class to create |
procedure SetNodeManager(); |
|
Set the node instance manager to use |
function NewNode; virtual; |
|
Create a new tree node |
procedure DisposeNode(); virtual; |
|
Dispose of a node outside of the tree |
procedure Add(); |
|
Add a new node to the tree |
function AddAscendingSequence(); |
|
|
procedure Delete(); |
|
Delete a node from the tree |
function Remove(); |
|
Remove a data item from the list. |
function RemovePointer(); |
|
Remove a pointer item from the list. |
procedure MoveDataLeftMost(); |
|
Move data to the nearest left element |
procedure MoveDataRightMost(); |
|
Move data to the nearest right element |
procedure Clear; |
|
Clears the tree |
procedure FreeAndClear; |
|
Clears the tree and frees nodes |
procedure FreeAndDelete(); virtual; |
|
Delete a node from the tree and destroy it |
function Equals(); override; |
|
Check if two trees are equal |
function IsEqual(); |
|
Check whether 2 tree instances are equal. |
procedure Assign(); virtual; |
|
Assign another tree |
property Root: TAVLTreeNode; [r] |
|
Root node of the tree |
|
Number of nodes in the tree. |
|
function Compare(); |
|
Compare 2 nodes |
function Find(); |
|
Find a data item in the tree. |
function FindKey(); |
|
Find a data item in the tree using alternate compare mechanism |
function FindNearestKey(); |
|
Find nearest key for a data pointer |
function FindSuccessor(); |
|
Find successor to node |
function FindPrecessor(); |
|
|
function FindLowest; |
|
Find the lowest (leftmost) node in the tree. |
function FindHighest; |
|
Find the highest (rightmost) node in the tree. |
function FindNearest(); |
|
Find the node closest to the data in the tree |
function FindPointer(); |
|
Search for a data pointer |
function FindLeftMost(); |
|
Find the node most left to a specified data node |
function FindRightMost(); |
|
Find the node most right to a specified node |
function FindLeftMostKey(); |
|
Find the node most left to a specified key node |
function FindRightMostKey(); |
|
Find the node most right to a specified key node |
function FindLeftMostSameKey(); |
|
Find the node most left to a specified node with the same data |
function FindRightMostSameKey(); |
|
Find the node most right of a specified node with the same data |
function GetEnumerator; |
|
Get an enumerator for the tree. |
function GetEnumeratorHighToLow; |
|
Return an enumerator that enumerates the tree in reversed order |
procedure ConsistencyCheck; virtual; |
|
Check the consistency of the tree |
procedure WriteReportToStream(); |
|
Write the contents of the tree consistency check to the stream |
function NodeToReportStr(); virtual; |
|
Create a textual dump of the tree |
function ReportAsString; |
|
Return the tree report as a string |
end; |
|
AVL tree component |
|
| | ||
TObject |
TAVLTree maintains a balanced AVL tree. The tree consists of TAVLTreeNode nodes, each of which has a Data pointer associated with it. The TAVLTree component offers methods to balance and search the tree.
By default, the list is searched with a simple pointer comparison algorithm, but a custom search mechanism can be specified in the OnCompare property.
|
Represents a node in the tree. |