CS 542 Quiz 4: Leftist Heaps and Edmonds-Karp Algorithm, Exercises of Data Structures and Algorithms

Two problem sets from a cs 542 quiz focusing on advanced data structures and algorithms. The first problem set deals with leftist heaps and their purge method, while the second problem set involves identifying the value of origin(find(s)) and an augmenting path in a graph using the edmonds-karp algorithm.

Typology: Exercises

2012/2013

Uploaded on 03/23/2013

saruy
saruy 🇮🇳

4.5

(120)

130 documents

1 / 2

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
- 1 -
1. (5 points) Consider a findmin operation on a leftist heap with lazy deletion that contains 50
deleted nodes. Findmin calls the purge method which returns a list of heaps. What is the
smallest number of heaps that can be in this list? What is the largest number?
Suppose we meld two leftist heaps, one with 25 internal nodes and another with 85. What is
the largest possible number of nodes, where the children must be swapped to maintain the
leftist property on the ranks?
CS 542 – Advanced Data Structures and Algorithms
Quiz 4
Jonathan Turner 3/21/2012
pf2

Partial preview of the text

Download CS 542 Quiz 4: Leftist Heaps and Edmonds-Karp Algorithm and more Exercises Data Structures and Algorithms in PDF only on Docsity!

  1. ( 5 points) Consider a findmin operation on a leftist heap with lazy deletion that contains 50 deleted nodes. Findmin calls the purge method which returns a list of heaps. What is the smallest number of heaps that can be in this list? What is the largest number? Suppose we meld two leftist heaps, one with 25 internal nodes and another with 85. What is the largest possible number of nodes, where the children must be swapped to maintain the leftist property on the ranks?

CS 542 – Advanced Data Structures and Algorithms

Quiz 4

Jonathan Turner 3/21/

  1. ( 5 points) The diagram below shows an intermediate state in the execution of the Edmonds- Karp algorithm for finding a matching in a graph (the partition data structure is not shown). In this state, what is the value of origin ( find ( s ))? If the edge { n,o } is processed next, the algorithm finds an augmenting path. What is that path?

+ a

c

b

d

e

g

i

h

j

k

m

o

n

p

x

s

u

t

v

w

+ st^ +

ts

jd