




版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
1、Tutorial 8: IndicesReview: IndexB+-treeDynamic HashingBitmap indicesGrid filesReview: B+-treeBalanced treeUse pointer, no need for sequential storageThe depth of the tree is in logarithmic orderSpace overheadInsertion and deletion overhead. However, can be handled in logarithmic time.Review: Extendi
2、ble HashingAllow the number of buckets to be modified dynamicallyInsert: If bucket is full, split itIf necessary, double the directoryBefore inserting, local depth of bucket = global depthInsert causes local depth global depthRemoval of data entry makes bucket emptyMerge “split image”Each directory
3、element points to same bucket as its split imageHalve directoryReview: Linear HashingHandles the problem of long overflow chains without using a directory, and handles duplicatesDirectory avoided in Linear Hashing by using overflow pagesChoose bucket to split in a round-robin wayReview: Bitmap Indic
4、esBitmap has as many bits as recordsBitmap indices are useful for queries on multiple attributesQueries are answered using bitmap operationsIntersection (AND)Union (OR)Complementation (NOT) Review: Grid FilesSpeed up multi-dimensional range searchA grid file on two attributes A and B can handle quer
5、ies of all following forms with reasonable efficiency(a1 A a2)(b1 B b2)(a1 A a2 b1 B b2)Review: Merge SortAlgorithm:Create sorted runsN-way merge:Read the first page of each run into buffer pageREPEATSelect the first record (in sorted order) among all buffer pagesWrite the record to the output buffe
6、r. If the output buffer is full write it to disk.Delete the record from its input buffer page.IF the buffer page becomes empty THENread the next page (if any) of the run into the buffer. UNTIL all input buffer pages are emptyExercise 1: B+-treeGiven a B+-tree:Draw the tree afterInserting 8Deleting 2
7、Deleting 32440191457321614222019292724995040Exercise 1 : B+-tree (1/3)2440191457321614222019292724995040Inserting 8145328751614222019292724402419995040Exercise 1 : B+-tree (2/3)Deleting 214753871614222019292724402419995040145328751614222019292724402419995040Exercise 1 : B+-tree (3/3)Deleting 3244019
8、14875161422201929272499504014753871614222019292724402419995040Given the following directory and buckets.Using extendible hashing, what will they be after:Inserting 22Inserting 3Inserting 9Exercise 2: Extendible Hashing20100128251141821110local depthglobal depthExercise 2 : Extendible Hashing (1/3)In
9、serting 22 (00010110)14 (0000 1110)18 (0001 0010)20100128251141821110300100012825118301101014223100101110111Exercise 2 : Extendible Hashing (2/3)Inserting 3 (0000 0011)3001000128253118301101014223100101110111300100012825118301101014223100101110111Exercise 2 : Extendible Hashing (3/3)Inserting 9 (000
10、0 1001)3001000128253118301101014223100101110111300100012825921830110101422310010111011132Exercise 3: Linear HashingGiven the following buckets:hi(key) = h(key) mod (2i*4)Level = 0Using linear hashing, what will they be after:Inserting 9Inserting 12Inserting 59h0h100011011000001010011primary pagesove
11、rflow pages48next=01352517735438362638Inserting 9Exercise 3 : Linear Hashing (1/3)h0h100011011000001010011primary pagesoverflow pages8next=113525177354383626389001004h0h100011011000001010011primary pagesoverflow pages48next=01352517735438362638Exercise 3 : Linear Hashing (2/3)Inserting 12h0h10001101
12、1000001010011primary pagesoverflow pages8next=11352517735438362638900100412h0h100011011000001010011primary pagesoverflow pages8next=113525177354383626389001004Exercise 3 : Linear Hashing (3/3)Inserting 59h0h100011011000001010011primary pagesoverflow pages8next=291725735438362638590010001101412513h0h
13、100011011000001010011primary pagesoverflow pages8next=11352517735438362638900100412Exercise 4: Merge SortGiven:800 pages of a file10 pages of main memorySort this file by mergingHow many passes you need at least?What is the total cost (page access)?How many pages of main memory you need at least, in
14、 order to sort this file in two passes?Exercise 4: Merge Sort (1/3)Given:800 pages of a file10 pages of main memoryHow many passes you need at least?1210111220791792800sorted run 1sorted run 2sorted run 80pass0pass1run 1run 2run 910*9 pagessorted run 110*8 pagessorted run 9pass2sorted file800 pagesExercise 4 : Merge Sort (2/3)Given:800 pages of a file10 pages of main memoryWhat is the total cost (page access)?Cost = br(2logM-1(br/M)+1)= 800 * (2 * log9(800/10) + 1)= 4,000Exercise 4 : Merge Sort (3/3)Given:800 pages of a fileHow
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 汽车维修服务抵押担保合同范本
- 老人进食护理课件
- 空间智能技术赋能交通基础设施数字化转型升级
- 老人压疮预防技术课件
- 清廉越城考试题库及答案
- 美术老人与儿童课件
- 安全生产标准化管理体系模板
- 测绘安全生产规范
- 小学实验室突发安全事故应急预案
- 常州市安全生产管理信息系统
- 电子商务平台客户服务标准规范
- 2023-2024学年山东省济宁市高二下学期7月期末考试物理试题(解析版)
- 2025届浙江省乐清市知临中学高一数学第一学期期末检测试题含解析
- 附件3:公司境外突发事件应急预案
- 北京市西城区北京市第四中学2024-2025学年七年级上学期分班考数学试卷
- 京东自营母婴采购合同协议书
- 4.凝血六项的检测与临床意义2
- 小孩办身份证的委托书范本
- 2025版新教材高中语文第二轮复习专题练-专题六 语言文字运用(含答案)
- 国家中医药管理局发布的406种中医优势病种诊疗方案和临床路径目录
- 高血压内容小讲课
评论
0/150
提交评论