[工学]DSB第01章.pptVIP

  • 0
  • 0
  • 约7.76千字
  • 约 46页
  • 2018-03-27 发布于浙江
  • 举报
[工学]DSB第01章

常见的渐近时间复杂性从小到大排列有: O(1) O(log2 n) O(n) O(nlog2 n) O(n2) O(n3) O(1) 算法只需执行有限个程序步。 O(4) 该种写法是错误。 作 业 P14 11 18 【程序1-2】 测试复数加法运算。 void PrintComplex(Complex a) { printf(a.x=%f, a.y=%f \n, a.x, a.y); } void main( ) { Complex a, b, c; a=Comp(1.0f, 2.0f); b=Comp(3.0f, 4.0f); c=Add(a, b); PrintComplex(a); PrintComplex(b); PrintComplex(c); } 在大多数情况下,讨论的一个抽象数据类型ADT往往代表一类具有相同结构和相同运算集的数据结构,它被称为一个类属抽象数据类型(generic ADT),它的元素类型通常并不重要 【程序1-1】 Complex的实现。 #include stdio.h #include stdlib.h typedef struct complex { float x, y; }Com

文档评论(0)

1亿VIP精品文档

相关文档