Homework 2 (by Ao Zeng) Solutions Due: Friday Sept 28, 11:59pm

Similar documents
Homework 6 (by Sivaprasad Sudhir) Solutions Due: Monday Nov 27, 11:59pm

Homework 5 (by Tupac Shakur) Due: Monday Dec 3, 11:59pm

Material You Need to Know

Homework 5 (by Tupac Shakur) Solutions Due: Monday Dec 3, 11:59pm

Homework 5 (by Joy Arulraj) Due: Monday Nov 13, 11:59pm

Module 3: Hashing Lecture 9: Static and Dynamic Hashing. The Lecture Contains: Static hashing. Hashing. Dynamic hashing. Extendible hashing.

Homework 5 (by Joy Arulraj) Solutions Due: Monday Nov 13, 11:59pm

CS143: Index. Book Chapters: (4 th ) , (5 th ) , , 12.10

Topics to Learn. Important concepts. Tree-based index. Hash-based index

IMPORTANT: Circle the last two letters of your class account:

University of California, Berkeley. CS 186 Introduction to Databases, Spring 2014, Prof. Dan Olteanu MIDTERM

Self assessment due: Monday 10/29/2018 at 11:59pm (submit via Gradescope)

CARNEGIE MELLON UNIVERSITY DEPT. OF COMPUTER SCIENCE DATABASE APPLICATIONS

CS 202, Fall 2017 Homework #4 Balanced Search Trees and Hashing Due Date: December 18, 2017

M-ary Search Tree. B-Trees. Solution: B-Trees. B-Tree: Example. B-Tree Properties. B-Trees (4.7 in Weiss)

else // m + 1 = d + }{{} 1 + d

Introduction to Indexing 2. Acknowledgements: Eamonn Keogh and Chotirat Ann Ratanamahatana

Homework 1: RA, SQL and B+-Trees (due September 24 th, 2014, 2:30pm, in class hard-copy please)

M-ary Search Tree. B-Trees. B-Trees. Solution: B-Trees. B-Tree: Example. B-Tree Properties. Maximum branching factor of M Complete tree has height =

CS 525: Advanced Database Organization 04: Indexing

Multiway searching. In the worst case of searching a complete binary search tree, we can make log(n) page faults Everyone knows what a page fault is?

Homework 6. Question Points Score Query Optimization 20 Functional Dependencies 20 Decompositions 30 Normal Forms 30 Total: 100

CS251-SE1. Midterm 2. Tuesday 11/1 8:00pm 9:00pm. There are 16 multiple-choice questions and 6 essay questions.

An AVL tree with N nodes is an excellent data. The Big-Oh analysis shows that most operations finish within O(log N) time

CS 245: Database System Principles

Carnegie Mellon University Department of Computer Science /615 - Database Applications C. Faloutsos & A. Pavlo, Spring 2014.

Some Practice Problems on Hardware, File Organization and Indexing

(2,4) Trees. 2/22/2006 (2,4) Trees 1

15-415/615 Homework 8, Page 2 of 11 Thu, 4/24/2014, 1:30pm

Physical Level of Databases: B+-Trees

Problem. Indexing with B-trees. Indexing. Primary Key Indexing. B-trees: Example. B-trees. primary key indexing

amiri advanced databases '05

(2,4) Trees Goodrich, Tamassia (2,4) Trees 1

Chapter 13: Indexing. Chapter 13. ? value. Topics. Indexing & Hashing. value. Conventional indexes B-trees Hashing schemes (self-study) record

Recall: Properties of B-Trees

Lecture 8 Index (B+-Tree and Hash)

Homework 1: RA, SQL and B+-Trees (due Feb 7, 2017, 9:30am, in class hard-copy please)

Announcements. Reading Material. Recap. Today 9/17/17. Storage (contd. from Lecture 6)

Access Methods. Basic Concepts. Index Evaluation Metrics. search key pointer. record. value. Value

Carnegie Mellon University Department of Computer Science /615 - Database Applications C. Faloutsos & A. Pavlo, Fall 2015

CSIT5300: Advanced Database Systems

Selection Queries. to answer a selection query (ssn=10) needs to traverse a full path.

CSE 562 Database Systems

Hash-Based Indexes. Chapter 11

Background: disk access vs. main memory access (1/2)

Database Applications (15-415)

Chapter 12: Indexing and Hashing (Cnt(

Introduction to Data Management. Lecture 15 (More About Indexing)

15-110: Principles of Computing, Spring 2018

University of Waterloo Department of Electrical and Computer Engineering ECE250 Algorithms and Data Structures Fall 2017

CS 202, Fall 2017 Homework #3 Heaps and AVL Trees

(2,4) Trees Goodrich, Tamassia. (2,4) Trees 1

Carnegie Mellon University Department of Computer Science /615 - Database Applications C. Faloutsos & A. Pavlo, Fall 2016

Data Structure and Algorithm Homework #6 Due: 5pm, Friday, June 14, 2013 TA === Homework submission instructions ===

CS 222/122C Fall 2016, Midterm Exam

Organizing Spatial Data

Sorting & Aggregations

Chapter 11: Indexing and Hashing

B-Tree. CS127 TAs. ** the best data structure ever

Carnegie Mellon University Department of Computer Science /615 - Database Applications C. Faloutsos & A. Pavlo, Spring 2014.

Data Management for Data Science

B+ TREES Examples. B Trees are dynamic. That is, the height of the tree grows and contracts as records are added and deleted.

CSE 21 Spring 2016 Homework 5. Instructions

Tree-Structured Indexes. Chapter 10

CS 222/122C Fall 2017, Final Exam. Sample solutions

Question 1. Part (a) [2 marks] what are different types of data independence? explain each in one line. Part (b) CSC 443 Term Test Solutions Fall 2017

Administrivia. Tree-Structured Indexes. Review. Today: B-Tree Indexes. A Note of Caution. Introduction

Multi-Way Search Trees

Multi-Way Search Trees

Hashing Techniques. Material based on slides by George Bebis

Database Management Systems (COP 5725) Homework 3

CS 186/286 Spring 2018 Midterm 1

4 Hash-Based Indexing

CSE 326: Data Structures B-Trees and B+ Trees

Sorting Algorithms. CSE21 Winter 2017, Day 2 (B00), Day 1-2 (A00) January 11, 2017

ecampus Submission Process

Indexing. Announcements. Basics. CPS 116 Introduction to Database Systems

COS 226 Fall 2015 Midterm Exam pts.; 60 minutes; 8 Qs; 15 pgs :00 p.m. Name:

Chapter 12: Indexing and Hashing. Basic Concepts

CS222P Fall 2017, Final Exam

IMPORTANT: Circle the last two letters of your class account:

Advances in Data Management Principles of Database Systems - 2 A.Poulovassilis

Homework /681: Artificial Intelligence (Fall 2017) Out: October 18, 2017 Due: October 29, 2017 at 11:59PM

Chapter 12: Indexing and Hashing

HOMEWORK 5. M. Neumann. Due: THU 22 FEB PM. Getting Started SUBMISSION INSTRUCTIONS

Intro to DB CHAPTER 12 INDEXING & HASHING

CS 3114 Data Structures and Algorithms READ THIS NOW!

5. Hashing. 5.1 General Idea. 5.2 Hash Function. 5.3 Separate Chaining. 5.4 Open Addressing. 5.5 Rehashing. 5.6 Extendible Hashing. 5.

COMP251: Algorithms and Data Structures. Jérôme Waldispühl School of Computer Science McGill University

Lecture 32. No computer use today. Reminders: Homework 11 is due today. Project 6 is due next Friday. Questions?

Lecture 23: Priority Queues, Part 2 10:00 AM, Mar 19, 2018

Introduction to Indexing R-trees. Hong Kong University of Science and Technology

m-way Search Tree: Empty, or if not empty then: Each internal node has q children and q 1 elements, for 2 q m.

Find the block in which the tuple should be! If there is free space, insert it! Otherwise, must create overflow pages!

Comp 335 File Structures. B - Trees

Kathleen Durant PhD Northeastern University CS Indexes

CSCI544, Fall 2016: Assignment 1

Design and Analysis of Algorithms Lecture- 9: Binary Search Trees

Database System Concepts, 6 th Ed. Silberschatz, Korth and Sudarshan See for conditions on re-use

Lecture 11: Multiway and (2,4) Trees. Courtesy to Goodrich, Tamassia and Olga Veksler

Transcription:

CARNEGIE MELLON UNIVERSITY DEPARTMENT OF COMPUTER SCIENCE 15-445/645 DATABASE SYSTEMS (FALL 2018) PROF. ANDY PAVLO Homework 2 (by Ao Zeng) Solutions Due: Friday Sept 28, 2018 @ 11:59pm IMPORTANT: Upload this PDF with your answers to Gradescope by 11:59pm on Friday Sept 28, 2018. Plagiarism: Homework may be discussed with other students, but all homework is to be completed individually. For your information: Graded out of 100 points; 4 questions total Rough time estimate: 1-4 hours (0.5-1 hours for each question) Revision : 2018/10/10 19:25 Question Points Score Extendible Hashing 30 Linear Hashing 20 B+Tree 40 Skip List and Radix Tree 10 Total: 100 1

15-445/645 (Fall 2018) Homework 2 Page 2 of 10 Question 1: Extendible Hashing............................... [30 points] Graded by: (a) Consider an extendible hashing structure that 1. Each bucket can hold up to 2 records 2. Is initially empty (only one empty bucket) Consider the result after inserting key 8, 16, 4, 3, 11, 12 in order, using the lowest-bits for the hash function. That is, records in a bucket of local depth d agree on their rightmost d bits. For example, key 4 (0100) and key 12 (1100) agree on their rightmost 3 bits (100). i. [5 points] What is the global depth of the resulting directory? 0 1 2 3 4 5 6 7 ii. [5 points] Now insert key 18. What is the local depth of the bucket that contains the key 18? 0 1 2 3 4 5 6 7 Figure 1: Extendible hashing (b) Answer the following questions about Figure 1. Suppose we insert keys 28, 30, 4, 8, 34 in order. i. [5 points] Which key will cause the first split? 28 30 4 8 34 None of the above ii. [5 points] Which key will first cause the directory to double in size? 28 30 4 8 34 None of the above Question 1 continues...

15-445/645 (Fall 2018) Homework 2 Page 3 of 10 (c) Start with the original hash table shown in Figure 1. Consider the result after deleting keys 14, 20 in order. (Try to coalesce when an existing bucket becomes empty). i. [5 points] How many buckets will remain? 0 1 2 3 4 5 None of the above ii. [5 points] What is the local depth of the bucket containing key 2? 0 1 2 3 4 5 None of the above Homework 2 continues...

15-445/645 (Fall 2018) Homework 2 Page 4 of 10 Question 2: Linear Hashing................................... [20 points] Graded by: Answer the following questions for the hash table of Figure 2. Assume that a bucket split occurs whenever an overflow page is created. h 0 (x) takes the rightmost 2 bits of key x as the hash value, and h 1 (x) takes the rightmost 3 bits of key x as the hash value. Figure 2: Linear Hashing (a) [5 points] What is the smallest key that is larger than 25 whose insertion will cause a split? 26 27 28 29 30 None of the above (b) [15 points] Starting from the hash table of Figure 2, plot the final hash table, after inserting 12, 13, 19. Remember to indicate the new hash function (if any), and to update the Next pointer, if needed. Use the following draw.io template for your answer: https://cmudb.io/fall2018-hw2-q2 Solution: See below Question 2 continues...

15-445/645 (Fall 2018) Homework 2 Page 5 of 10 Homework 2 continues...

15-445/645 (Fall 2018) Homework 2 Page 6 of 10 Question 3: B+Tree........................................... [40 points] Graded by: (a) [5 points] Consider the B+tree shown in Figure 3. Figure 3: B+ Tree of order d = 4 and height h = 3. What is the minimum number of pointers to be followed to satisfy the query: Get all records with key greater than 11 and less than 27? 1 2 3 4 5 None of the above (b) Using the B+tree in Figure 3 of order d = 4 and height h = 3 levels, make the following assumptions: With respect to, follow the convention used in the textbook, and in Figure 3, that is, the left pointer is for <, the right one for. In case of underflow, if you can borrow from both siblings, choose the one on the right. For all questions below, use the standard B+tree algorithm given in the slides and the textbook (on insertions: 2-to-1 split, no deferred splits; on deletions: no underflowing pages). Use the following draw.io template for your answer: https://cmudb.io/fall2018-hw2-q3-1 NOTE: In all cases, start from the B+tree of Figure 3. i. [5 points] Start from the original B+tree; insert 10. ii. [6 points] Start from the original B+tree; insert 10, 18. iii. [6 points] Start from the original B+tree; delete 11. iv. [6 points] Start from the original B+tree; delete 31. Solution: i) Question 3 continues...

15-445/645 (Fall 2018) Homework 2 Page 7 of 10 ii) iii) iv) Question 3 continues...

15-445/645 (Fall 2018) Homework 2 Page 8 of 10 Figure 4: B+ Tree of order d = 4 and height h = 2. (c) Consider the B+tree in Figure 4 of order d = 4 and height h = 2 levels. Please make the same assumptions that are in the previous question. For all questions below, use the standard B+tree algorithm given in the slides and the textbook (on insertions: 2-to-1 split, no deferred splits; on deletions: no underflowing pages). Use the following draw.io template for your answer: https://cmudb.io/fall2018-hw2-q3-2 NOTE: In all cases, start from the B+tree of Figure 4. i. [6 points] Start from the original B+tree; insert 28. ii. [6 points] Start from the original B+tree; delete 3. Solution: i) ii) Homework 2 continues...

15-445/645 (Fall 2018) Homework 2 Page 9 of 10 Question 4: Skip List and Radix Tree..........................[10 points] Graded by: Figure 5: Skip List (a) [5 points] Consider the skip list in Figure 5. Suppose we want to insert key 20. Which of the following node(s) might directly point to the new node? Select all that apply. 3 6 8 15 21 37 50 Nil None of the above Figure 6: Radix Tree (b) [5 points] Consider the radix tree in Figure 6. Is it a valid radix tree? If yes, draw the tree after inserting the new word APPROVE. Otherwise, draw a valid radix tree with existing words. Use the following draw.io template for your answer: https://cmudb.io/fall2018-hw2-q4 Solution: Not valid Question 4 continues...

15-445/645 (Fall 2018) Homework 2 Page 10 of 10 End of Homework 2