Lely core libraries
2.3.4
|
Go to the source code of this file.
Functions | |
void | pheap_insert (struct pheap *heap, struct pnode *node) |
Inserts a node into a pairing heap. More... | |
void | pheap_remove (struct pheap *heap, struct pnode *node) |
Removes a node from a pairing heap. More... | |
struct pnode * | pheap_find (const struct pheap *heap, const void *key) |
Finds a node in a pairing heap. More... | |
int | pheap_contains (const struct pheap *heap, const struct pnode *node) |
Checks if a node is part of a pairing heap. More... | |
This file is part of the utilities library; it contains the implementation of the pairing heap.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Definition in file pheap.c.
Inserts a node into a pairing heap.
This is an O(1) operation. This function does not check whether a node with the same key already exists, or whether the node is already part of another heap. It is the responsibility of the user to ensure that the node is not part of the heap before calling this function.
Removes a node from a pairing heap.
This is an (amortized) O(log(n)) operation. It is the responsibility of the user to ensure that the node is part of the heap before calling this function.
Finds a node in a pairing heap.
This is an O(n) operation.