Skip to main content Accessibility help
×
Hostname: page-component-84b7d79bbc-dwq4g Total loading time: 0 Render date: 2024-07-30T09:09:51.745Z Has data issue: false hasContentIssue false

9 - Finding celebrities

Published online by Cambridge University Press:  05 March 2013

Richard Bird
Affiliation:
University of Oxford
Get access

Summary

The setting is a tutorial on functional algorithm design. There are four students: Anne, Jack, Mary and Theo.

Teacher: Good morning class. Today I would like you to solve the following problem. Imagine a set P of people at a party. Say a subset C of P forms a celebrity clique if C is nonempty, everybody at the party knows every member of C, but members of C know only each other. Assuming there is such a clique at the party, your problem is to write a functional program for finding it. As data for the problem you are given a binary predicate knows and the set P as a list ps not containing duplicates.

Jack: Just to be clear, does every member of a celebrity clique actually know everyone else in the clique? And does everyone know themselves?

Teacher: As to the first question, yes, it follows from the definition: everyone in the clique is known by everyone at the party. As to the second question, the answer is not really relevant to the problem, so ask a philosopher. If it simplifies things to assume that x knows x for all x, then go ahead and do so.

Theo: This is going to be a hard problem, isn't it? I mean, the problem of determining whether there is a clique of size k in a party of n people will take Ω(nk) steps, so we are looking at an exponential time algorithm.

Type
Chapter
Information
Publisher: Cambridge University Press
Print publication year: 2010

Access options

Get access to the full version of this content by using one of the access options below. (Log in options will check for institutional or personal access. Content may require purchase if you do not have access.)

Save book to Kindle

To save this book to your Kindle, first ensure coreplatform@cambridge.org is added to your Approved Personal Document E-mail List under your Personal Document Settings on the Manage Your Content and Devices page of your Amazon account. Then enter the ‘name’ part of your Kindle email address below. Find out more about saving to your Kindle.

Note you can select to save to either the @free.kindle.com or @kindle.com variations. ‘@free.kindle.com’ emails are free but can only be saved to your device when it is connected to wi-fi. ‘@kindle.com’ emails can be delivered even when you are not connected to wi-fi, but note that service fees apply.

Find out more about the Kindle Personal Document Service.

  • Finding celebrities
  • Richard Bird, University of Oxford
  • Book: Pearls of Functional Algorithm Design
  • Online publication: 05 March 2013
  • Chapter DOI: https://doi.org/10.1017/CBO9780511763199.010
Available formats
×

Save book to Dropbox

To save content items to your account, please confirm that you agree to abide by our usage policies. If this is the first time you use this feature, you will be asked to authorise Cambridge Core to connect with your account. Find out more about saving content to Dropbox.

  • Finding celebrities
  • Richard Bird, University of Oxford
  • Book: Pearls of Functional Algorithm Design
  • Online publication: 05 March 2013
  • Chapter DOI: https://doi.org/10.1017/CBO9780511763199.010
Available formats
×

Save book to Google Drive

To save content items to your account, please confirm that you agree to abide by our usage policies. If this is the first time you use this feature, you will be asked to authorise Cambridge Core to connect with your account. Find out more about saving content to Google Drive.

  • Finding celebrities
  • Richard Bird, University of Oxford
  • Book: Pearls of Functional Algorithm Design
  • Online publication: 05 March 2013
  • Chapter DOI: https://doi.org/10.1017/CBO9780511763199.010
Available formats
×