midterm2

# midterm2 - node is split, and there are an odd number of...

This preview shows pages 1–3. Sign up to view the full content.

CS143 Midterm, Spring 2006, Section 2 — Page: 2 Problem 1: 10 points Consider the relation Class(dept, cnum, title) . The tuple (’CS’, 143, ’Database’) in the relation means that department ’CS’ is o f ering class 143 on ’Database’. Write a relational algebra expression that returns all departments that o f er at least three classes. Remember that simplicity and clarity count as well as correctness. Solution π D 1 .dept ( σ D 1 .dept = D 2 .dept = D 3 .dept D 1 .cnum ± = D 2 .cnum D 3 .cnum ( ρ D 1 ( Class ) × ρ D 2 ( Class ) × ρ D 3 ( Class ))

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
CS143 Midterm, Spring 2006, Section 2 — Page: 3 Problem 2: 10 points 1. Here is a simple B+tree with a root and 4 leaves. 40 50 10 20 30 40 70 70 80 60 90 95 97 99 95 Assume that each node has room for 3 keys and 4 pointers. Also assume that when a
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: node is split, and there are an odd number of pointers, the new node with the larger number of pointers is to the left of the other. Suppose that we insert a record with key 35 into this tree. Draw the new tree. Solution 70 30 40 95 10 20 30 45 40 50 60 70 80 90 95 97 99 This should be 35 CS143 Midterm, Spring 2006, Section 2 Page: 4 2. Here is another B+tree. 70 80 40 50 10 20 95 97 40 95 70 Assume that each node has room for 3 keys and 4 pointers. Suppose that we delete the record with key 40 from this tree. Draw the new tree. Solution 70 30 40 95 95 99 50 70 80 97 10 20...
View Full Document

## This note was uploaded on 04/28/2010 for the course CS 143 taught by Professor Zaniolo during the Fall '01 term at UCLA.

### Page1 / 3

midterm2 - node is split, and there are an odd number of...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document
Ask a homework question - tutors are online