chap21-solutions - Selected Solutions for Chapter 21: Data...

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

View Full Document Right Arrow Icon
Selected Solutions for Chapter 21: Data Structures for Disjoint Sets Solution to Exercise 21.2-3 We want to show that we can assign O.1/ charges to MAKE-SET and FIND-SET and an O. lg n/ charge to UNION such that the charges for a sequence of these operations are enough to cover the cost of the sequence— O.m C n lg n/ , according to the theorem. When talking about the charge for each kind of operation, it is helpful to also be able to talk about the number of each kind of operation. Consider the usual sequence of m MAKE-SET, UNION, and FIND-SET operations, n of which are MAKE-SET operations, and let l < n be the number of UNION operations. (Recall the discussion in Section 21.1 about there being at most n N 1 UNION operations.) Then there are n MAKE-SET operations, l UNION operations, and m N n N l FIND-SET operations. The theorem didn’t separately name the number l of UNIONs; rather, it bounded the number by n . If you go through the proof of the theorem with l UNIONs, you get the time bound O.m N l C l lg l/ D O.m
Background image of page 1

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

View Full DocumentRight Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 04/20/2010 for the course IE ie200 taught by Professor . during the Spring '10 term at 카이스트, 한국과학기술원.

Page1 / 2

chap21-solutions - Selected Solutions for Chapter 21: Data...

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

View Full Document Right Arrow Icon
Ask a homework question - tutors are online