zoukankan      html  css  js  c++  java
  • 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.

  • 相关阅读:
    潜水员
    混合背包
    多重背包问题
    归并排序——最省时的排序
    HDU 1556 Color the ball
    2016 ACM/ICPC Asia Regional Dalian Online Football Games
    poj 2352 Stars
    poj 2299 Ultra-QuickSort
    关于原码反码补码以及位元算
    2016 湖南省省赛 Problem A: 2016
  • 原文地址:https://www.cnblogs.com/blfshiye/p/5150878.html
Copyright © 2011-2022 走看看