## ## Datastructures: GAP package providing common datastructures. ## ## Copyright (C) 2015-2017 The datastructures team. ## For list of the team members, please refer to the COPYRIGHT file. ## ## This package is licensed under the GPL 2 or later, please refer ## to the COPYRIGHT.md and LICENSE files for details. ##
# This file contains a GAP implementation of a binary max-heap. # # Some hints for writing efficient binary heap implementations: # <https://stackoverflow.com/questions/6531543> # # Note that while there are other heap datastructures which in # theory have better asymptotical behavior than binary heaps, in # real-world applications, a well-tunes binary heap often # outperforms other heap implementations anyway, due to its # simplicity, low constant (in O-notation) and cache friendliness. #
if Length(arg) = 1then if IsFunction(arg[1]) then
isLess := arg[1]; else
data := arg[1]; fi; elif Length(arg) = 2then
isLess := arg[1];
data := arg[2]; elif Length(arg) > 2then
Error("Wrong number of arguments"); fi;
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.