  
  
                                [1X datastructures [101X
  
  
                [1X Collection of standard data structures for [5XGAP[105X [101X
  
  
                                     0.4.0
  
  
                                14 October 2025
  
  
                                Markus Pfeiffer
  
                                    Max Horn
  
                             Christopher Jefferson
  
                                  Steve Linton
  
  
  
  Markus Pfeiffer
      Email:    [7Xmailto:markus.pfeiffer@st-andrews.ac.uk[107X
      Homepage: [7Xhttp://www.morphism.de/~markusp[107X
      Address:  [33X[0;14YSchool of Computer Science[133X
                [33X[0;14YUniversity of St Andrews[133X
                [33X[0;14YJack Cole Building, North Haugh[133X
                [33X[0;14YSt Andrews, Fife, KY16 9SX[133X
                [33X[0;14YUnited Kingdom[133X
  
  
  Max Horn
      Email:    [7Xmailto:mhorn@rptu.de[107X
      Homepage: [7Xhttps://www.quendi.de/math[107X
      Address:  [33X[0;14YFachbereich Mathematik[133X
                [33X[0;14YRPTU Kaiserslautern-Landau[133X
                [33X[0;14YGottlieb-Daimler-Straße 48[133X
                [33X[0;14Y67663 Kaiserslautern[133X
                [33X[0;14YGermany[133X
  
  
  Christopher Jefferson
      Email:    [7Xmailto:caj21@st-andrews.ac.uk[107X
      Homepage: [7Xhttp://caj.host.cs.st-andrews.ac.uk/[107X
      Address:  [33X[0;14YSchool of Computer Science[133X
                [33X[0;14YUniversity of St Andrews[133X
                [33X[0;14YJack Cole Building, North Haugh[133X
                [33X[0;14YSt Andrews, Fife, KY16 9SX[133X
                [33X[0;14YUnited Kingdom[133X
  
  
  Steve Linton
      Email:    [7Xmailto:steve.linton@st-andrews.ac.uk[107X
      Homepage: [7Xhttp://sl4.host.cs.st-andrews.ac.uk/[107X
      Address:  [33X[0;14YSchool of Computer Science[133X
                [33X[0;14YUniversity of St Andrews[133X
                [33X[0;14YJack Cole Building, North Haugh[133X
                [33X[0;14YSt Andrews, Fife, KY16 9SX[133X
                [33X[0;14YUnited Kingdom[133X
  
  
  
  -------------------------------------------------------
  [1XCopyright[101X
  [33X[0;0Y©  2015-18  by  Chris  Jefferson,  Steve  Linton, Markus Pfeiffer, Max Horn,
  Reimer Behrends and others[133X
  
  [33X[0;0Y[5Xdatastructures[105X  package  is  free  software;  you can redistribute it and/or
  modify   it   under   the   terms   of   the   GNU  General  Public  License
  ([7Xhttps://www.fsf.org/licenses/gpl.html[107X)  as  published  by the Free Software
  Foundation;  either  version 2 of the License, or (at your option) any later
  version.[133X
  
  
  -------------------------------------------------------
  [1XAcknowledgements[101X
  [33X[0;0YWe  appreciate  very  much  all  past  and  future comments, suggestions and
  contributions  to  this  package and its documentation provided by [5XGAP[105X users
  and developers.[133X
  
  
  -------------------------------------------------------
  
  
  [1XContents (datastructures)[101X
  
  1 [33X[0;0YIntroduction[133X
    1.1 [33X[0;0YPurpose and goals of this package[133X
    1.2 [33X[0;0YOverview over this manual[133X
    1.3 [33X[0;0YFeedback[133X
  2 [33X[0;0YInstallation[133X
    2.1 [33X[0;0YBuilding the Kernel Module[133X
    2.2 [33X[0;0YBuilding the Documentation[133X
  3 [33X[0;0YHeaps[133X
    3.1 [33X[0;0YIntroduction[133X
    3.2 [33X[0;0YAPI[133X
      3.2-1 IsHeap
      3.2-2 Heap
      3.2-3 NewHeap
      3.2-4 Push
      3.2-5 Peek
      3.2-6 Pop
      3.2-7 Merge
    3.3 [33X[0;0YBinary Heaps[133X
      3.3-1 BinaryHeap
    3.4 [33X[0;0YPairing Heaps[133X
      3.4-1 PairingHeap
    3.5 [33X[0;0YDeclarations[133X
      3.5-1 IsBinaryHeapFlatRep
    3.6 [33X[0;0YImplementation[133X
      3.6-1 IsPairingHeapFlatRep
  4 [33X[0;0YQueues and Deques[133X
    4.1 [33X[0;0YAPI[133X
      4.1-1 IsQueue
      4.1-2 IsDeque
      4.1-3 PushBack
      4.1-4 PushFront
      4.1-5 PopBack
      4.1-6 PopFront
      4.1-7 Enqueue
      4.1-8 Dequeue
      4.1-9 Capacity
      4.1-10 Capacity
      4.1-11 Length
      4.1-12 Length
    4.2 [33X[0;0YDeques implemented using plain lists[133X
      4.2-1 PlistDeque
      4.2-2 PlistDequePushFront
      4.2-3 PlistDequePushBack
      4.2-4 PlistDequePopFront
      4.2-5 PlistDequePopBack
      4.2-6 PlistDequePeekFront
      4.2-7 PlistDequePeekBack
      4.2-8 PlistDequeExpand
  5 [33X[0;0YUnion-Find[133X
    5.1 [33X[0;0YIntroduction[133X
    5.2 [33X[0;0YAPI[133X
      5.2-1 IsPartitionDS
      5.2-2 PartitionDSCons
      5.2-3 PartitionDSCons
      5.2-4 PartitionDS
      5.2-5 PartitionDS
      5.2-6 PartitionDS
      5.2-7 PartitionDS
      5.2-8 Representative
      5.2-9 Unite
      5.2-10 RootsIteratorOfPartitionDS
      5.2-11 RootsOfPartitionDS
      5.2-12 NumberParts
      5.2-13 SizeUnderlyingSetDS
      5.2-14 PartsOfPartitionDS
  6 [33X[0;0YHash Functions[133X
    6.1 [33X[0;0YIntroduction[133X
    6.2 [33X[0;0YHash Functions for Basic Types[133X
      6.2-1 HashBasic
    6.3 [33X[0;0YHash Functions for Permutation Groups[133X
      6.3-1 Hash_PermGroup_Fast
      6.3-2 Hash_PermGroup_Complete
  7 [33X[0;0YHashmaps[133X
    7.1 [33X[0;0YAPI[133X
      7.1-1 IsHashMap
      7.1-2 HashMap
      7.1-3 Keys
      7.1-4 Values
      7.1-5 KeyIterator
      7.1-6 ValueIterator
      7.1-7 KeyValueIterator
      7.1-8 \[\]
      7.1-9 \[\]\:\=
      7.1-10 \in
      7.1-11 IsBound\[\]
      7.1-12 Unbind\[\]
      7.1-13 Size
      7.1-14 IsEmpty
  8 [33X[0;0YHashsets[133X
    8.1 [33X[0;0YAPI[133X
      8.1-1 IsHashSet
      8.1-2 HashSet
      8.1-3 AddSet
      8.1-4 \in
      8.1-5 RemoveSet
      8.1-6 Size
      8.1-7 IsEmpty
      8.1-8 Set
      8.1-9 AsSet
      8.1-10 Iterator
  9 [33X[0;0YMemoisation[133X
    9.1 [33X[0;0YMemoisation with HashMap[133X
      9.1-1 MemoizeFunction
  10 [33X[0;0YOrdered Set Datastructures[133X
    10.1 [33X[0;0YUsage[133X
    10.2 [33X[0;0YAPI[133X
      10.2-1 IsOrderedSetDS
      10.2-2 IsStandardOrderedSetDS
      10.2-3 OrderedSetDS
      10.2-4 OrderedSetDS
      10.2-5 OrderedSetDS
      10.2-6 OrderedSetDS
      10.2-7 OrderedSetDS
      10.2-8 OrderedSetDS
      10.2-9 OrderedSetDS
      10.2-10 AddSet
      10.2-11 RemoveSet
      10.2-12 \in
      10.2-13 LessFunction
      10.2-14 Size
      10.2-15 IteratorSorted
    10.3 [33X[0;0YDefault methods[133X
      10.3-1 Iterator
      10.3-2 AsSSortedList
      10.3-3 AsSortedList
      10.3-4 AsList
      10.3-5 EnumeratorSorted
      10.3-6 Enumerator
      10.3-7 IsEmpty
      10.3-8 Length
      10.3-9 Position
      10.3-10 PositionSortedOp
      10.3-11 PositionSortedOp
  11 [33X[0;0YSlices[133X
    11.1 [33X[0;0YAPI[133X
      11.1-1 Slice
      11.1-2 IsSlice
      11.1-3 \[\]
      11.1-4 \[\]\:\=
      11.1-5 \in
      11.1-6 IsBound\[\]
      11.1-7 Unbind\[\]
      11.1-8 Length
  12 [33X[0;0YStacks[133X
    12.1 [33X[0;0YAPI[133X
      12.1-1 Stack
      12.1-2 IsStack
      12.1-3 Push
      12.1-4 Peek
      12.1-5 Pop
      12.1-6 Size
  
  
  [32X
