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?

  • 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?

  • 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?

  • 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?

  • 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?

  • 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

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

  • 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
target 5000lines 30articles 400hours
First week 180/180 1/1 20/20
Second week 1049/1229 1/2 18/38
Third week 1037/2266 3/7 22/60
Fourth week 1120/3386 2/9 30/90
时间: 2024-07-29 09:25:20

20162314 《Program Design & Data Structures》Learning Summary Of The Eleventh Week的相关文章

《Python For Data Analysis》学习笔记-1

在引言章节里,介绍了MovieLens 1M数据集的处理示例.书中介绍该数据集来自GroupLens Research(http://www.groupLens.org/node/73),该地址会直接跳转到https://grouplens.org/datasets/movielens/,这里面提供了来自MovieLens网站的各种评估数据集,可以下载相应的压缩包,我们需要的MovieLens 1M数据集也在里面. 下载解压后的文件夹如下: 这三个dat表都会在示例中用到,但是我所阅读的<Pyt

《python for data analysis》第四章,numpy的基本使用

<利用python进行数据分析>第四章的程序,介绍了numpy的基本使用方法.(第三章为Ipython的基本使用) 科学计算.常用函数.数组处理.线性代数运算.随机模块-- # -*- coding:utf-8 -*-# <python for data analysis>第四章, numpy基础# 数组与矢量计算import numpy as npimport time # 开始计时start = time.time() # 创建一个arraydata = np.array([[

《python for data analysis》第十章,时间序列

< python for data analysis >一书的第十章例程, 主要介绍时间序列(time series)数据的处理.label:1. datetime object.timestamp object.period object2. pandas的Series和DataFrame object的两种特殊索引:DatetimeIndex 和 PeriodIndex3. 时区的表达与处理4. imestamp object.period object的频率概念,及其频率转换5. 两种频

《Advanced Data Structures》读书笔记

1.基础数据结构 1.1.栈 1.2.队列 1.3 双端队列 1.4.动态分配节点 1.5.数组类的"阴影拷贝" 2.搜索树 3.平衡搜索树 4.区间集合 5.堆 6.并查集 7.变换 8.字符串 9.哈希表 10.附录

《Motion Design for iOS》(二)

流动的现实动画的起源 在1981年,迪士尼长期动画师Ollie Johnston 和 Frank Thomas(迪士尼九大元老的成员--1920年代和1930年代迪士尼的原始动画团队)写了一本名为<Disney Animation: The Illusion of Life>的书,概括了他们在迪士尼早期卡通工作中倡导人物动画的基本原则. 这12个基本动画原则在<Disney Animation: The Illusion of Life>一书中被详细的描述,并且这本书现在被工作于此

《Motion Design for iOS》(三十)

现在让我们为我们的警告框视图创建一个不同类型的动作,从屏幕的中央出来并带有一些弹性动画来获取用户的注意.这就是它看起来的样子. 这是一个更简单的动画,因为我们只动画了警告框transform的一个属性,即scale.我们设置它的初始scale为0来建立我们的警告框视图. lofter 2016/6/30 9:15:45 alertView.transform = CGAffineTransformMakeScale(0, 0); 和之前一样,我们想要给覆盖层和警告框一个淡化的动画,不过这一次我们

《Motion Design for iOS》(二十五)

现在我们已经了解了Core Animation的基础并且使用了优秀的框架JNWSpringAnimation来模仿弹簧系统,是时候来开始写一些真实的示例代码了. 仿制一个iOS AlertView 重现一个熟悉的界面元素是一个很好的熟悉动画开发的方式.首先,让我们创建我们自己的标准iOS警告视图.这是内置的警告视图的样子. 在本指南之前的章节中,我解释了分解一个动画的各个组成部分有多么重要,这样你就可以准确地构建它.仅仅说"警告框动画进入屏幕"是不够的,你需要准确地知道发生了什么.让我

《Motion Design for iOS》(三十三)

即使这些动画可以通过一个淡出动画曲线来完成,我也想使用含有相同damping和stiffness值得弹簧动画,这样我就可以减缓速度.这里不会有弹性,只是非常平滑的过渡. CGFloat dampingStiffness = 16.0f; // 主app背景的比例动画 JNWSpringAnimation *scale = [JNWSpringAnimation animationWithKeyPath:@"transform.scale"]; scale.damping = dampi

《Motion Design for iOS》(三十二)

现在让我们添加我们的图标按钮. // 添加图标 UIButton *icon = [UIButton buttonWithType:UIButtonTypeCustom]; [icon setImage:[UIImage imageNamed:@"map-icon"] forState:UIControlStateNormal]; [icon addTarget:self action:@selector(didTapMapIcon:) forControlEvents:UIContr