数据结构学习(—)

1.数据(data)就是计算机加工处理的对象。一般分为两类:数值数据和非数值数据(numerical data and non-numerical data)

其中前者主要为整数、实数和复数,主要用于计算,而后者主要为图片、音像、表格、字符等,量大且联系复杂。

数据的成分数据为数据元素(data element)

数据元素包括许多数据项(data item)

数据结构(data structure)包含数据的逻辑结构(logical structure)和数据的存储结构(storege structure)

数据的逻辑结构主要分为:集合(set)、树形结构(tree)、图状结构(graph)、线性结构(linear),其中前三者可以称为非线性结构(non-linear structure)。

数据的存储结构两种基本的方法为顺序(sequential)和链接(linked)

数据结构一旦创建,其结构不会发生改变,称为静态数据结构(static data structure),否则称为动态数据结构(dynamic data structure),若该数据结构上定义了插入和删除运算,则该数据结构被认为是动态数据结构。

2.数据抽象(data abstraction):将数据元素间的逻辑关系和数据在计算机内的具体表示分开考虑。

过程抽象(procedual abstraction):将一个运算的定义和实现运算的具体方法分开考虑。

抽象数据类型(abstract data type,ADT)是一种将数据对象及其运算的规范独立于它们的实现,实行封装和信息隐蔽,使用与实现分离。

例:Complex(c 语言)

#include

#include

typedef struct  complex

{

        float x, y;

}Complex;

Complex CreateComp(float x, float y)

{

    Complex c;

    c.x = x; c.y = y;

    return c;

}

Complex Add(Complex a, Complex b)

{

    Complex c;

    c.x = a.x + b.x;

    c.y = a.y  + b.y;

    return c;

}

void PrintComplex(Complex a)

{

printf("%3.2f+%3.2fi\n",a.x,a.y);

}

void main()

{

Complex a, b, c;

a = CreateComp(1.0f,2.0f);

b = CreateComp(3.0f,4.0f);

c = Add(a,b);

PrintComplex(a);

PrintComplex(b);

PrintComplex(c);

}

3.算法的五个特征:输入、输出、确定、可行、有穷。

算法的性能:正确、简明、健壮、效率。

算法的时间复杂度和空间复杂度。

 

 

 

 

 

 

 

 

 

 

 

 

 

你可能感兴趣的:(个人学习)