当前位置:高等教育资讯网  >  中国高校课件下载中心  >  大学文库  >  浏览文档

《算法入门》(英文版)Lecture 14 Prof. Charles E. Leiserson

资源类别:文库,文档格式:PDF,文档页数:34,文件大小:198.39KB,团购合买
How large should a hash table be? Problem: What if we don’t know the proper size in advance? Goal: Make the table as small as possible, but large enough so that it won’t overflow (or otherwise become inefficient).
点击下载完整版文档(PDF)

Introduction to algorithms 6.046J/18,401J/SMA5503 Lecture 14 Prof charles e. leiserson

Introduction to Algorithms 6.046J/18.401J/SMA5503 Lecture 14 Prof. Charles E. Leiserson

How large should a hash table be? Goal: Make the table as small as possible but large enough so that it wont overflow(or otherwise become inefficient Problem: what if we don 't know the proper size In advance ? Solution: Dynamic tables IDEA: Whenever the table overflows, grow'it by allocating(via malloc or new )a new, larger table. Move all items from the old table into the new one, and free the storage for the old table c 2001 by Charles E Leiserson Introduction to Agorithms Day 24 L14.2

© 2001 by Charles E. Leiserson Introduction to Algorithms Day 24 L14.2 How large should a hash table be? Problem: What if we don’t know the proper size in advance? Goal: Make the table as small as possible, but large enough so that it won’t overflow (or otherwise become inefficient). IDEA: Whenever the table overflows, “grow” it by allocating (via malloc or new) a new, larger table. Move all items from the old table into the new one, and free the storage for the old table. Solution: Dynamic tables

Example of a dynamic table 1.Ⅰ NSErT 2.Ⅰ NSERT overflow c 2001 by Charles E Leiserson Introduction to Agorithms Day 24 L14.3

© 2001 by Charles E. Leiserson Introduction to Algorithms Day 24 L14.3 Example of a dynamic table 1. INSERT 1 2. INSERT overflow

Example of a dynamic table 1.Ⅰ NSErT 2.Ⅰ NSERT overflow c 2001 by Charles E Leiserson Introduction to Agorithms Day 24 L14.4

© 2001 by Charles E. Leiserson Introduction to Algorithms Day 24 L14.4 11 Example of a dynamic table 1. INSERT 2. INSERT overflow

Example of a dynamic table 1.Ⅰ NSErT 2.Ⅰ NSERT 2 c 2001 by Charles E Leiserson Introduction to Agorithms Day 24 L14.5

© 2001 by Charles E. Leiserson Introduction to Algorithms Day 24 L14.5 11 2 Example of a dynamic table 1. INSERT 2. INSERT

Example of a dynamic table 1 INSERT 2.Ⅰ NSERT 2 3. INSERT overflow c 2001 by Charles E Leiserson Introduction to Agorithms Day 24 L14.6

© 2001 by Charles E. Leiserson Introduction to Algorithms Day 24 L14.6 Example of a dynamic table 1. INSERT 2. INSERT 11 22 3. INSERT overflow

Example of a dynamic table 1 INSERT 2.Ⅰ NSERT 2 3. INSERT overflow c 2001 by Charles E Leiserson Introduction to Agorithms Day24L14.7

© 2001 by Charles E. Leiserson Introduction to Algorithms Day 24 L14.7 Example of a dynamic table 1. INSERT 2. INSERT 3. INSERT 2 1 overflow

Example of a dynamic table 1 INSERT 2.Ⅰ NSERT 2 3. INSERT c 2001 by Charles E Leiserson Introduction to Agorithms Day 24 L14.8

© 2001 by Charles E. Leiserson Introduction to Algorithms Day 24 L14.8 Example of a dynamic table 1. INSERT 2. INSERT 3. INSERT 2 1

Example of a dynamic table 1 INSERT 2.Ⅰ NSERT 3. INSERT 234 4. INSERT c 2001 by Charles E Leiserson Introduction to Agorithms Day 24 L14.9

© 2001 by Charles E. Leiserson Introduction to Algorithms Day 24 L14.9 Example of a dynamic table 1. INSERT 2. INSERT 3. INSERT 4. INSERT 4 3 2 1

Example of a dynamic table 1 INSERT 2.Ⅰ NSERT 3. INSERT 234 4. INSERT 5 INSERT overflow c 2001 by Charles E Leiserson Introduction to Agorithms Day24L14.10

© 2001 by Charles E. Leiserson Introduction to Algorithms Day 24 L14.10 Example of a dynamic table 1. INSERT 2. INSERT 3. INSERT 4. INSERT 5. INSERT 4 3 2 1 overflow

点击下载完整版文档(PDF)VIP每日下载上限内不扣除下载券和下载次数;
按次数下载不扣除下载券;
24小时内重复下载只扣除一次;
顺序:VIP每日次数-->可用次数-->下载券;
共34页,可试读12页,点击继续阅读 ↓↓
相关文档

关于我们|帮助中心|下载说明|相关软件|意见反馈|联系我们

Copyright © 2008-现在 cucdc.com 高等教育资讯网 版权所有