首页 > 其他 > 详细

ADT(abstract data types)抽象数据类型

时间:2016-09-17 16:29:29      阅读:303      评论:0      收藏:0      [点我收藏+]

1、What is it?

An abstract data type is a set of objects together with a set of operations.

抽象数据类型是带有一组操作的一组对象的集合。

ADTS=objects+operations

 

2、How to define?

ADT Name
  Describe of data;
  Operations;
End ADT
Operations description:

Name(parameter list)
  Input:     data used to input
  Output:   data used to output
  Pre-condition:  if the condiont my not be satisfied, the operation may not be correct
  
 Post-condition:  The status after the operation be executed

  

3、Example

ADT Bigint
    Data
        n: 0..2^54-1
    Operations:
       
         addone
            Pre-condition:     n+1<2^54;
            Post-condition:    n=n+1;
        
         subone
             Pre-condition:    n>0;
             Post-condition:   n=n-1;
         
         mult(x,y)
             Input:   (x:Bigint);
             Output: (y:Bigint);
             Pre-condition:  n*x.n<2^54;
             Post-condition: y.n=n*x.n;
End ADT

 

ADT(abstract data types)抽象数据类型

原文:http://www.cnblogs.com/KennyRom/p/5878945.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!