版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
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. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 2025山东济南市检察机关招聘聘用制书记员25人备考核心题库及答案解析
- 2025辽宁沈阳盛京资产管理集团有限公司所属子公司沈阳华海锟泰投资有限公司所属子公司招聘5人笔试重点题库及答案解析
- 2026年长沙市中小学素质教育实践基地岳麓营地编外合同制教师、教官招聘备考题库及1套完整答案详解
- 2025年宝钛集团有限公司高层次人才招聘考试核心题库及答案解析
- 2025年蚌埠自贸区城发人力资源有限公司第八期招聘2名考试重点试题及答案解析
- 2025年博思睿人力招聘(派遣至海宁市袁花镇百溪工业社区)备考题库完整答案详解
- 2025年鲤城区第五中心小学诚聘合同制顶岗教师备考题库及一套答案详解
- 2025年菏泽检察机关公开招聘59人备考题库有答案详解
- 2025年郑州九中教育集团招聘教师13名考试重点试题及答案解析
- 2025年12月江苏南京市江北新区教育局所属事业单位招聘教师20人考试核心题库及答案解析
- 全国水资源中长期供求规划技术指南与大纲解读
- 货物运输安全管理制度
- 《电子工业全光网络工程技术规范》
- 3 面粉码垛机器人的结构设计
- 脑梗塞所致精神障碍病人护理
- 护理组长竞聘演讲
- 露天煤矿安全用电培训
- 股骨粗隆间骨折分型培训课件
- 24年一年级上册语文期末复习21天冲刺计划(每日5道题)
- 静疗工作总结
- 2024-2025学年吉安市泰和县六上数学期末综合测试模拟试题含解析
评论
0/150
提交评论