20172330 2017-2018-1 《Java程序设计》第十周学习总结

20172330 2017-2018-1 《程序设计与数据结构》第十周学习总结

教材学习内容总结

本周的学习内容为集合

集合

  • 对象具有定义良好的接口,从而成为一种实现集合的完善体制。
  • 动态数据结构的大小规模随需要增长和收缩。
  • 通过引用和保存对象引用来实现一个链表的管理。
  • 通过自习操作对象引用,可以实现插入和删除操作。
  • 动态链表有许多不同的实现。
  • 队列是一种以先进先出方式管理数据的线性数据结构。
  • 堆栈是一种以后进后出的方式管理数据的线性数据结构。
  • 树是一种以层次结构组织数据的非线性数据结构。
  • 图是非线性数据结构,使用常见的边来连接节点。
  • Java集合类API定义了几种以不同方式实现的集合类。
  • Java集合类API中定义的类为泛型。
  • 泛型保证了集合中对象类型的兼容性。

教材学习中的问题和解决过程

  • 问题1:
    数据结构之线性结构与非线性结构的区别、分类
  • 问题1解决方案:
    线性结构有唯一的首元素(第一个元素)
    线性结构有唯一的尾元素(最后一个元素)
    除首元素外,所有的元素都有唯一的“前驱”
    除尾元素外,所有的元素都有唯一的“后继”
    数据元素之间存在“一对一”的关系
    例如:数组A1,A2,A3,........An,首元素就是A1,尾元素就是An

什么结构属于线性结构呢?
顺序表(一维数组),堆,栈,队列,链表

那非线性结构是什么呢?
数据元素之间是一对多,或者是多对一的关系

非线性结构有什么呢?
图(群结构),树(层次结构),多维数组

代码托管


上周考试错题总结

  • 问题1:Why is the following method one which has infinite recursion?
    public int infiniteRecursion(int n)
    {
    if (n > 0) return infiniteRecursion(n) + 1;
    else return 0;
    }
    A Because there is no base case
    B Because the base case will never be true
    C Because the recursive call does not move the parameter closer to the base case
    D Because the recursive call moves the problem further away from the base case
    E None of the above, there is no infinite recursion in this method
    分析:如果输入大于零的数,那么将不会进入else语句,也就说一直在大于零的情况下进行递归的循环

  • 问题2:A recursive algorithm is superior to an iterative algorithm along which of the following criteria?
    A The recursive algorithm is easier to debug
    B The recursive algorithm is computationally more efficient
    C The recursive algorithm is more elegant
    D The recursive algorithm requires less memory to execute
    E all of the above
    分析:当时我理解的应该是a递归算法更易于调试,但是答案给的是c。

  • 问题3:The difference between direct and indirect recursion is
    A direct recursion occurs when a method invokes itself; indirect recursion occurs when there is an intervening method
    B indirect recursion occurs when a method invokes itself; direct recursion occurs when there is an intervening method
    C direct recursion only occurs with methods declared to be private; indirect recursion can occur with methods declared to be private, protected, or public
    D indirect recursion only occurs with methods declared to be private; direct recursion can occur with methods declared to be private, protected, or public
    E none of the above
    分析:A选项的意思是:当一个方法调用自己时,就会发生直接递归;间接递归发生在有干预方法的时候。直接递归意味着一个方法直接调用自己,而不使用中间方法。当在原始方法再次被调用之前有一个或多个中间方法时,就会发生间接递归。

  • 问题4:The following method correctly multiplies two ints so long as both are non-negative:
    public int mpy(int a, int b)
    {
    return (b > 0) ? a + mpy(a, b-1) : 0;
    }
    A true
    B false
    分析:乘法只是重复加法,所以重复的加a,b倍,就是两个数的乘积。

结对及互评

点评模板:

  • 博客中值得学习的或问题:
    • 严域俊同学在进行异常和错误的区别时进行了详细的描述并配了图
    • 同时在根据自己代码中出现的问题又一次进行了查询和解答。
  • 代码中值得学习的或问题:
    • 这周初终于完成了四则运算,并且成功运行。
    • commit依旧很详细,有条理性。

点评过的同学博客和代码

  • 本周结对学习情况
    • 20172333
    • 结对学习内容
      • 学习第十三章pp项目。
      • 学习集合的具体内容
      • 对四则运算的收尾。

其他(感悟、思考等,可选)

终于这本书学习完了,nice啊。

学习进度条

代码行数(新增/累积) 博客量(新增/累积) 学习时间(新增/累积) 重要成长
目标 5000行 30篇 400小时
第一周 180/180 2/2 20/25
第二周 312/414 2/4 20/45
第三周 557/971 1/5 25/70
第四周 1217/2242 2/7 44/114
第五周 734/2976 1/8 24/138
第六周 523/3509 1/9 20/158
第七周 697/4206 1/10 24/182
第八周 1118/5324 3/13 30/212
第九周 656/5980 2/15 20/232
第十周 909/6889 1/16 20/252

参考:软件工程软件的估计为什么这么难软件工程 估计方法

  • 计划学习时间:20小时

  • 实际学习时间:20小时

  • 改进情况:

这周对于课后练习做的没有那么吃力,但还是存在一些对于类的编写的问题,希望继续加油。

参考资料

原文地址:https://www.cnblogs.com/linanlalala/p/9064627.html