{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

Homework 2 Solutions

# Homework 2 Solutions - Homework 2 CSE 132A Due by noon on...

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

Homework 2 CSE 132A Due by noon on Monday, Dec. 8, by sliding under Alin’s office door. Problem 2 [20pts] Suppose that a B + tree index on (branch-name, branch- city) is available on relation branch . What would be the best way to handle the following selection? σ ( branch - city< Brooklyn 00 ) ( assets< 5000) ( branch - name = 00 Downtown 00 ) ( branch ) Solution: Assume that the index compares keys lexicographically, with the brach-name as the most significant component: ( n 1 , c 1 ) < ( n 2 , c 2 ) iff c 1 < c 2 or ( c 1 = c 2 and n 1 < n 2 ) . Lookup the value (“Brooklyn”,”Downtown”) in the index, to get to the corresponding leaf l . All values satisfying σ ( branch - city< Brooklyn 00 ) ( branch - name = 00 Downtown 00 ) ( branch ) are reachable by going to the left sibling leaves of l as long as the branch-name attribute is “Downtown”. For each visited leaf, output only if assets < 5000. Note that, if the most significant component is branch-city instead, then we must go through all of l ’s left sibling leaves, not just those with branch- name=”Downtown”.

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

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

### What students are saying

• As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

Kiran Temple University Fox School of Business ‘17, Course Hero Intern

• I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

Dana University of Pennsylvania ‘17, Course Hero Intern

• The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

Jill Tulane University ‘16, Course Hero Intern