• ADT Example


    Example Data Types: Integer, and Character


    Example (Integer Data Type)

    The integer data type can consist of:
    data values: −∞,...,−2,−1,0,1,2,...,∞

    operations: +,−,∗,%,/,...


    Example (Character Data Type)
    The character data type can consist of:
    data values: ,..., ’A’,’B’,...,’a’,’b’,..., ’1’, ’2’, ...

    operations: <, >, ≤, ≥, ==, ...


    Example Data Types: Person, and 2D Points
    We can have data types for composite data too.


    Example (Person Data Type)
    The Person data type can consist of:
    data values: { 15, "Bob", "Buckwheat"}, { 50, "Jack", "Bauer" },
    ...
    operations: set/get firstname, set/get lastname, set/get age,
    ==, ...


    Example (2D Point Data Type)


    The 2D Point data type can consist of:
    data values: (0,0),(1,0),(3.7,−8.5)···
    operations: get distance between 2 points, move point, add
    points together, ...


    Data Structures: Familiar examples


    Example (Data Structure: Array)


    Elements: All the same data type (integer, float, Person,
    etc,.).
    Structure: Elements form a contiguous sequence in which
    each element is numbered with an index.


    Example (Data Structure: Matrix (2D array))
    Elements: All the same data type (integer, float, Person,
    etc,.).
    Structure: Elements form a grid in which each element has a
    row and column position.

  • 相关阅读:
    Android平板电脑开发实战详解和典型案例
    UG NX10.0技术大全(不附光盘)
    SolidWorks 2018中文版机械设计应用大全
    1192.回文字符串
    1193.矩阵转置
    1195.最长&最短文本
    1194.八进制
    1196.成绩排序
    1197.奇偶检验
    1199.找位置
  • 原文地址:https://www.cnblogs.com/blfshiye/p/5150878.html
Copyright © 2020-2023  润新知