Question

4. Ranking/Unranking Subsets. Let A be a set of n elements and set Sk(A) be the collection of all k-element subsets of A. Rec

0 0
Add a comment Improve this question Transcribed image text
Answer #1

a.

ALGORITHM RANK [Given an object of order v. Output its rank r in the lexicographically arranged list of all objects of order v]:

Set r 4- 0. Walk forward on the path, on each edge e augmenting r by f(e). Halt at the terminal vertex.

b.

ALGORITHM UNRANK [Given an order v and an integer r, 0 ~ r ~ b(v) -- 1. Output the object co of rank r among those of order v]: Begin at v with r' = r. Having arrived at w with r', exit along the highest e for whichf(e) < r' and set r' 4- r' -- f(e). Continue from fin(e) with r'. Halt at the terminal vertex with 0

Add a comment
Know the answer?
Add Answer to:
4. Ranking/Unranking Subsets. Let A be a set of n elements and set Sk(A) be the collection of all k-element subsets of A. Recall that |Sk(A)I - (a.) (8 points) Describe a ranking algorithm to rank a...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT