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

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

Summary of Key Concepts

  • In hashing, elements are stored in a hash table, with their location in thetable determined by a hashing function.

  • The situation where two elements or keys map to the same location in the table is called a collision.

  • A hashing function that maps each element to a unique position in the table is said to be a perfect hashing function.

  • Extraction involves using only a part of the element’s value or key to compute the location at which to store the element.

  • The division method is very effective when dealing with an unknown set of key values.

  • In the shift folding method, the parts of the key are added together to create the index.

  • The length-dependent method and the mid-square method may also be effectively used with strings by manipulating the binary representations of the characters in the string.

  • Although Java provides a hashcode method for all objects, it is often preferable to define a specific hashing function for any particular class.

  • The chaining method for handling collisions simply treats the hash table conceptually as a table of collections rather than as a table of individual cells.

  • The open addressing method for handling collisions looks for another open position in the table other than the one to which the element is originally hashed.

  • The load factor is the maximum percentage occupancy allowed in the hash table before it is resized.

Problem and solution in teaching materials.

What is the difference between a hash table and the other collections we have discussed?

1062769-20171118234717468-1518458882.png

  • Elements are placed into a hash table at an index produced by a function of the value of the element or a key of the element.
  • This is unique from other collections where the position/locationof an element in the collection is determined either by comparison
  • with the other values in the collection or by the order in which the elements were added or removed from the collection.

What is our goal for a hashing function?

1062769-20171118234704687-568274256.png

  • We need a hashing function that will do a good job of distributing elements into positions in the table.

What is the consequence of not having a good hashing function?

1062769-20171118234653046-1020144376.png

  • If we do not have a good hashing function, the result will be too many elements mapped to the same location in the table. This will result in poor performance.

Why is deletion from an open addressing implementation a problem?

1062769-20171118234636765-1852712591.png

  • Because of the way that a path is formed in open addressing,deleting an element from the middle of that path can cause elements beyond that on the path to be unreachable.

What is the load factor and how does it affect table size?

1062769-20171118234624343-515443370.png

  • The load factor is the maximum percentage occupancy allowed in the hash table before it is resized. Once the load factor has
  • been reached, a new table is created that is twice the size of the current table, and then all of the elements in the current table
  • are inserted into the new table.

Code hosting

1062769-20171022234121834-1415959686.png

What is the maximum number of edges for an undirected graph? A directed graph?

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.

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/7858444.html

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

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值