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

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

教材学习内容总结

  • 本周学习教材第十五章,主要内容是掌握数据结构中的队列
  • 队列也是一种线性结构,与栈不同的是,队列为先进先出(FIFO)
  • 用链表和循环数组实现队列

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

  • 问题1:在看到书上循环数组实现队列的代码时,其中enqueue()方法中有一行rear = (rear+1) % queue.length看不大懂,虽然书上解释了,但仍仍然不是很明白
  • 问题1解决方案:上课的时候老师讲解了这个问题。因为是循环数组,如果只是用rear++的话,当数组到最后一个时,rear的值要大于数组长度了,但此时rear的值必须置位0,用以上代码就能解决这个问题,可以适用于各种情况。

代码托管

注:第五周国庆放假,所以第五第六周博客一起写的,这些代码量应该是这两周的

上周考试错题总结

  • 错题1
When one type of object contains a link to another object of the same type, the object is sometimes called _________ .
A .circular
B .recursive
C .self-referential
D .a stack
E .a queue

正确答案: C  

解析:A self-referential object is one that refers to another object of the same type.(自引用对象是指同一类型的另一个对象。)
  • 错题2
A stack is the ideal collection to use when _______________________ .
A .implementing a line in a simulation
B .evaluating a postfix expression
C .evaluating an infix expression
D .implementing a quick sort
E .none of the above

正确答案: A

解析:A queue is ideal for implementing a line in a simulation, such as a first-come, first-served situation.(队列是在模拟中实现行的理想,例如第一个来、第一个接收服务的情况。)
  • 错题3
In a array-based implementation of a queue that stores the front of the queue at index 0 in the array, the dequeue operation is ___________________.
A .impossible to implement
B .has several special cases
C .O(n)
D .O(n2)
E .none of the above

正确答案: C  

解析:It requires a linear amount of time to shift all elements of the queue down an index after a remove is applied.

结对及互评

本周结对学习情况

  • 20162325

  • 结对学习内容

    • 用循环数组实现队列
    • 第六周课下测试的错题

思考

这周学习了另外一种数据结构——队列。队列也是一种线性结构,和栈不同的是,它是先进先出(FIFO)。其实队列和栈还是有很多相似的地方,学过栈之后再学队列就没有之前那么懵了,对于如何实现和应用,也可以参照栈来做,总的来说,比学栈的时候要轻松一些。

学习进度条

代码行数(新增/累积) 博客量(新增/累积) 学习时间(新增/累积) 重要成长
目标 5000行 30篇 400小时
第一周 0/0 1/1 10/10
第二周 0/0 0/1 15/25
第三周 721/721 3/4 15/40
第四周 0/721 1/5 15/55
第五周 1234/1955 1/6 16/71
第六周 0/1955 3/9 20/91
  • 计划学习时间:21小时

  • 实际学习时间:20小时

  • 改进情况:基本达到目标,继续保持,同时确保学习的效率和质量

参考资料

posted @ 2017-10-15 21:42  20162311张之睿  阅读(293)  评论(0编辑  收藏  举报