加拿大二年级计算机专业的家庭作业~ 大家帮忙看看。
mylzw 2004-08-16 03:40:54 1.Specify the abstract data type LIST with the following operations
* null: denotes the empty list
* add: inserts a sort of NAT into the list
* del: deletes an element in the list at a certain position
* length: returns the length of the list
* append: add two lists together
* sum: returns the sum of the natural numbers stored in the list
* isEMPTY: return whether the list is empty
specify the NAT and BOOLEAN first
2.Specify the abstract data type SET with the following operations
* null: denotes the empty set
* add: adds one element to the set
* insert: inserts one element to the set
* remove: deletes one element from the set
* card: returns the union of two sets
* intrsct: returns the intersection of two sets
* isIN: returns whether an element is in the set
The element is NAT
3.Specify the abstract data type BITREE(binary tree)with the following operations
* empty: denotes the empty tree
* add: creates a binary tree(input is one element and two binary trees,output is a binary tree
with the elemnet as the root and two input trees as the two subtrees)
* left: returns the left subtree
* right: returns the right subtree
* isIN: returns whether an element is in the tree
The element is NAT
直接给答案就可以,~ 最好加注释。