 |
 |
 |
 |
 |
 |
 |
 |
 |
 |
 |
 |
 |
 |
 |
 |
 |
 |
 |
 |
 |
 |
ä |
Introduction
|
|
|
|
ä |
Type
Binary_tree
|
|
|
|
ä |
Imports
Boolean
|
|
|
ä |
Informal
description: Defines a binary
tree where the
|
|
|
data
is of generic type Elem. See previous transparency for
|
|
|
interface
operation descriptions. Build is an additional
|
|
|
primitive
constructor operation which is introduced to
|
|
|
simplify
the specification. It builds a tree given the value of
|
|
|
|
anode
and the left and right sub-trees.
|
|
|
ä |
Signature
|
|
|
|
ä |
Create
-> Binary_tree
|
|
|
|
ä |
Add(Binary_tree,
Elem) -> Binary_tree
|
|
|
|
ä |
Left(Binary_tree)
-> Binary_tree
|
|
|
|
ä |
Data(Binary_tree)
-> Elem
|
|
|
|
ä |
Right(Binary_tree)
-> Binary_tree
|
|
|
|
ä |
Is_empty(Binary_tree)
-> Boolean
|
|
|
|
ä |
Contains(Binary_tree,
Elem) -> Boolean
|
|
|
|
ä |
Build(Binary_tree,
Elm, Binary_tree) -> Binary_tree
|
|