Heaps can can be converted
List of Import References :
See BOOL
See Char
See DENOTATION
See Heap
See Nat
See Option
See Seq
See String
See Tree
SIGNATURE HeapConv[data, <]
$Date: 2010-09-30 18:24:17 +0200 (Do, 30. Sep 2010) $ ($Revision: 616 $)
IMPORT Heap[data, <] ONLY heap Tree[data] ONLY tree Seq[data] ONLY seq Seq[seq[data]] ONLY seq String ONLY string
SORT data FUN < : data ** data -> bool
Heaps are represented as follows:
FUN ` : (data -> denotation) -> heap -> denotation FUN ` : (data -> string) -> heap -> string
These functions produce a twodimensional output of the heap. This works only for fixed width fonts, of course. The output assumes arbitrarily long lines. The function aborts, if one representation has zero length.
FUN graphic : (data -> denotation) -> heap -> denotation FUN graphic : (data -> string ) -> heap -> string
There are three possibilities: you can get the datas either in inorder -- left/node/right, in preorder -- node/left/right, or in postorder -- left/right/node.
FUN asSeqIn asSeqPre asSeqPost : heap -> seq[data]
asSeqBreadth
gives you a sequence of sequence of
datas. The ith element of the sequence contains all elements of level
i from left to right.
FUN asSeqBreadth : heap -> seq[seq[data]]
You can get the underlying tree structure or convert a tree to a heap
FUN asHeap: tree -> heap FUN asTree: heap -> tree
next node: HeapFilter,
prev node: HeapCompare,
up to node: Subsystem Heaps