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

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

教材学习内容总结

  1. 树的定义及相关术语
  2. 树的遍历(先序遍历,中序遍历,后序遍历,层序遍历)
  3. 树的实现

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

  • 问题1:对于书上这个遍历的过程有点捋不清楚。

  • 问题1解决方案:自己反复推敲之后,已经熟练掌握。

代码调试中的问题和解决过程

  • 问题1:层序遍历既然不是通过递归实现的,那么它究竟是如何实现的呢?
  • 问题1解决方案:反复阅读课本后,感觉还是不太懂,于是我在网上搜索了一下,找到一篇博客,找到了相关代码并进行学习。
import java.util.LinkedList;  
public class LevelOrder  
{  
 

   public void levelIterator(BiTree root)  
  {  
      if(root == null)  
  

    {  
          return ;  

      }  

      LinkedList<BiTree> queue = new LinkedList<BiTree>();  

      BiTree current = null;  

      queue.offer(root);//将根节点入队  

      while(!queue.isEmpty())  
      {  
          current = queue.poll();//出队队头元素并访问  

          System.out.print(current.val +"-->");  

          if(current.left != null)//如果当前节点的左节点不为空入队  



          {  
              queue.offer(current.left);  
          }  

          if(current.right != null)//如果当前节点的右节点不为空,把右节点入队  

          {  
              queue.offer(current.right);  

          }  
      }  
        
  }  

}  

代码托管

点评过的同学博客和代码

  • 本周结对学习情况
    • 20162318
    • 结对照片
    • 结对学习内容
      • 树的学习

上周考试错题总结

  • 错题一:本题是因为自己粗心,看错选项导致错误,着实不应该。
    What exception is thrown if the pop method is called on an empty stack?
    A .EmptyStackException
    B .NoSuchElementException
    C .ArrayOutOfBoundsException
    D .EmptyCollectionException
    E .none of the above
  • 错题二:通过看解析:在应用删除后,需要线性时间将队列的所有元素都向下移动。发现是自己之前对概念理解不够到位
    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

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

树的这一章,总的来说感觉自己理解的还错吧,希望自己可以在实践中继续成长。

学习进度条

代码行数(新增/累积) 博客量(新增/累积) 学习时间(新增/累积) 重要成长
目标 5000行 30篇 400小时
第一周 0/0 1/1 10/10
第二周 0/0 1/2 10/20
第三周 163/163 1/3 12/32
第四周 207/370 1/3 11/43
第五周 931/1301 1/4 12/55
第六周 391/1692 2/6 15/70
第七周 760/2452 2/8 13/83
  • 计划学习时间:13小时

  • 实际学习时间:10小时

参考资料

posted @ 2017-10-22 23:00  20162304张浩林  阅读(183)  评论(0编辑  收藏  举报