Click or drag to resize

BinaryHeapTElementUpdateKeyTKeyType Method (TElement, ActionTElement, TKeyType, TKeyType)

Updates the key of the element passed in. Only use this method for elements where the key is a property of the element, not the element itself. This means that if you have a heap with value typed elements (e.g. integers), updating the key is updating the value of the element itself, and because a heap might contain elements with the same value, this could lead to undefined results.

Namespace:  SD.Tools.Algorithmia.Heaps
Assembly:  SD.Tools.Algorithmia (in SD.Tools.Algorithmia.dll) Version: 1.4.0.0 (1.4.19.0529)
Syntax
public override void UpdateKey<TKeyType>(
	TElement element,
	Action<TElement, TKeyType> keyUpdateFunc,
	TKeyType newValue
)

Parameters

element
Type: TElement
The element which key has to be updated
keyUpdateFunc
Type: SystemActionTElement, TKeyType
The key update func, which takes 2 parameters: the element to update and the new key value.
newValue
Type: TKeyType
The new value for the key.

Type Parameters

TKeyType
The type of the key type.
Remarks
The element to update is first looked up in the heap. If the new key violates the heap property (e.g. the key is bigger than the key of the parent in a max-heap) the elements in the heap are restructured in such a way that the heap again obeys the heap property.
See Also