20162314 《Program Design & Data Structures》Learning Summary Of The Ninth Week

20162314 2017-2018-1 《Program Design & Data Structures》Learning Summary Of The Ninth Week

Summary of Key Concepts

  • A heap is a complete binary tree in which each element is greater than or equal to both of its children.

  • Adding an element to a heap can be accomplished by adding the element as a leaf, then moving it upward as appropriate.

  • Removing the maximum element from the heap can be accomplished by replacing the root with the last leaf, then moving it downward as appropriate.

  • A heap sort makes use of the primary characteristic of a heap to sort a set of elements.

  • A priority queue is not a FIFO queue. It orders elements according to priority,independent of the order in which they are added to the queue.

Problem and solution in teaching materials.

What is the difference between a heap and a binary search tree?

1062769-20171105230001404-350264141.png

  • A binary search tree and a heap are both binary trees that have constraints on the relationships among their elements. The nodes in a binary search tree are less than their left child and
  • greater than or equal to their right child, whereas the nodes in a heap (maxheap) are greater than or equal to both children.

What is the difference between a minheap and a maxheap?

1062769-20171105230455810-1390802631.png

  • A minheap keeps the smallest value in the tree at the root,whereas a maxheap keeps the largest value at the root.
  • Otherwise, their strategies and implementations are similar.

How is the largest element removed from a heap?

1062769-20171105230746029-915654533.png

  • The maximum element is removed from a heap (maxheap) by replacing the root with the last leaf of the tree, then moving that
  • element down the tree as appropriate to reassert the proper relationships among the elements.

Code hosting

1062769-20171022234121834-1415959686.png

Summary of error for last week.

Linear search is always more effective than binary search.The answer should be false, for the situation of "n = 2".

Evaluate for my partner

  • Advantage and problem in the blog:
    • Concise and comprehensie
    • Uncleary to the content
    • Mould is amazing
  • Advantage and problem in the code:
    • Serious writing.
    • Wonderful idea
    • Too less

Learning situation of partner

  • 20162310

  • Learning content of partner:
    • Algorithm
    • Recursion
    • HanoiTowers and maze

Anything else that want to say

  • It's not easy to persere on utizing English to write a blog.But I'm getting used to doing this because of the benefit.

Academic progress check

Code line number(increasing/accumulative)Blog number(inc/acc)studying time(inc/acc)progress
target5000lines30articles400hours
First week180/1801/120/20
Second week1049/12291/218/38
Third week1037/22663/722/60
Fourth week1120/33862/930/90

转载于:https://www.cnblogs.com/CS162314/p/7789323.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值