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 .
To save content items to your Kindle, first ensure no-reply@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.
We study the problem of identifying a small number $k\sim n^\theta$, $0\lt \theta \lt 1$, of infected individuals within a large population of size $n$ by testing groups of individuals simultaneously. All tests are conducted concurrently. The goal is to minimise the total number of tests required. In this paper, we make the (realistic) assumption that tests are noisy, that is, that a group that contains an infected individual may return a negative test result or one that does not contain an infected individual may return a positive test result with a certain probability. The noise need not be symmetric. We develop an algorithm called SPARC that correctly identifies the set of infected individuals up to $o(k)$ errors with high probability with the asymptotically minimum number of tests. Additionally, we develop an algorithm called SPEX that exactly identifies the set of infected individuals w.h.p. with a number of tests that match the information-theoretic lower bound for the constant column design, a powerful and well-studied test design.
The Traveling Salesman Problem (TSP) is a central topic in discrete mathematics and theoretical computer science. It has been one of the driving forces in combinatorial optimization. The design and analysis of better and better approximation algorithms for the TSP has proved challenging but very fruitful. This is the first book on approximation algorithms for the TSP, featuring a comprehensive collection of all major results and an overview of the most intriguing open problems. Many of the presented results have been discovered only recently, and some are published here for the first time, including better approximation algorithms for the asymmetric TSP and its path version. This book constitutes and advances the state of the art and makes it accessible to a wider audience. Featuring detailed proofs, over 170 exercises, and 100 color figures, this book is an excellent resource for teaching, self-study, and further research.
We derive an asymptotic expansion for the critical percolation density of the random connection model as the dimension of the encapsulating space tends to infinity. We calculate rigorously the first expansion terms for the Gilbert disk model, the hyper-cubic model, the Gaussian connection kernel, and a coordinate-wise Cauchy kernel.
Java is one of the world’s most popular programming languages. Widely used in enterprise software development, Java’s strengths lie in its combination of performance and portability, as well as its large, robust library of built-in features, which allow developers to create complex applications entirely within the language. Java was developed in the early 1990s by a team from Sun Microsystems led by James Gosling. Initially called Oak (after a tree outside Gosling’s office), the new language was intended to be a development environment for interactive TV, but pivoted to the emerging World Wide Web after its public release in 1995. Since then, Java has expanded into almost every area of software development. It is the default programming language for Android mobile devices, the Hadoop large-scale data processing system, and Minecraft. Java is one of the most well-known object-oriented programming languages.
This chapter surveys the core elements of Java programming, assuming some familiarity with programming in any language. If you already have Java experience, it will be a refresher on important points. If your experience is with Python, JavaScript, or other languages, this chapter will help you understand how Java does things differently.
After the linear data structures and hash tables, we’re now ready to introduce the third major kind of structure: trees, which represent hierarchical data. Computer science, like nature, delights in trees: There are a huge number of tree-based structures customized for different problems. In particular, trees are used to construct map data structures that provide useful alternatives to hash tables.
A heap is a tree-based data structure that’s designed to quickly return the maximum or minimum of its items. Like a search tree, it maintains a special ordering among its nodes, and takes advantage of the hierarchical nature of binary trees to perform its operations in O(log n) time. Heaps are the primary implementation of the priority queue abstract data type. Like the first-in-first-out queues we studied in Chapter 13, a priority queue supports operations to insert and remove elements, but also maintains an ordering among its items. Polling the queue returns the next item according to the underlying ordering, rather than strictly returning items in FIFO order. Priority queues are used in applications that need to continually fetch the “next” item of a dynamic set that may change over time. A common application is ordering events by time in a simulation program.
Seymour Papert published Mindstorms in 1980. Subtitled Children, Computers, and Powerful Ideas, the book advocated for making computational thinking a core part of the curriculum for young children (Papert, 1980). Mindstorms was influential in computer education circles, and the approaches it described were the first exposure to programming and computer science for many children. LEGO later adopted the name for a line of programmable building sets.
The previous two chapters introduced hash functions and hash tables. In this chapter, we’ll combine hash tables with lists to construct a search engine index. Our index will map a search word to the list of locations where that word occurs in a set of text documents. The data for our example search engine will come from the plays of William Shakespeare, the most influential English-language dramatist in history. We’ll work primarily with the text of Macbeth. The play provides a good development example because the text is rich enough to be interesting, but the structured script format makes it easy to extract everything we need with a reasonable amount of code.
The stack is the Incredible Hulk of data structures: superficially dumb, but so strong that it doesn’t matter. Stacks have only a few basic operations and they’re easy to implement, but they unlock a number of algorithms that are both theoretically powerful and practically important. You may recall that we previously discussed the role of the stack in recursion, and there’s a connection between the stack as an explicit data structure and recursive methods that use a stack implicitly.
Up to this point we’ve focused on introducing the Java language and – starting with the previous chapter – the technique of algorithm analysis. We’re now ready to put that machinery to work by describing our first important new data structure: lists. A list is like an array, in that it represents an ordered sequence of data values, but lists are more flexible: They support operations for dynamically inserting and removing data as the program executes. We’ve already used Java’s built-in ArrayList class to manage a collection of values; now we’re ready to talk about how it’s implemented internally.
The last chapter ended on a down note, when we realized that the standard binary search tree can’t guarantee O(log n) performance if it isn’t balanced. This chapter introduces self-balancing search trees. All three of the trees we’ll examine – 2-3-4 trees, B-trees, and red–black trees – implement search tree operations, but perform extra work to ensure that the tree stays balanced.
Arrays are Java’s fundamental low-level data structure, used to manage fixed-size collections of items. Chapter 2 introduced ArrayList, which implemented a resizable sequential collection of data items, similar to Python’s lists. Arrays are lower-level, but they’re often the best choice for representing fixed-size collections of items, such as matrices. Arrays are also the basic building block of many higher-level data structures. Therefore, understanding how to create and manipulate basic arrays is an essential skill.
Recursion is a fundamental concept in computer science. A recursive algorithm is one that defines a solution to a problem in terms of itself. That is, recursive techniques solve large problems by building up solutions of smaller instances of the same problem. This turns out to be a powerful technique, because many advanced algorithmic problems and data structures are fundamentally self-similar.
Pinterest is a social media platform that allows users to assemble images or other media into customized lists, then share those lists with others. Pinterest calls these lists “pinboards” and the items added to each board “pins,” analogous to real-world physical bulletin boards. Like other social media systems, Pinterest wants to recommend new content to its users to keep them engaged with the service. In 2018, Pinterest introduced a system called Pixie as a component of their overall recommendation infrastructure (Eksombatchai et al., 2018). It uses a graph model to represent the connections among items, then explores that graph in a randomized way to generate recommendations. In this chapter, we’ll build our own system based on the graph algorithms used by Pixie.
We live in a networked world. Professional networks, social networks, neural networks – we’re all familiar with the idea that connections matter. This chapter introduces graphs, our last major topic. Graphs are the primary tool for modeling connections or relationships among a set of items; binary trees, for example, are a special type of graph. Graph models illustrate the power of abstraction: They capture the underlying structure of a network, independent of what the elements actually represent. Therefore, graph algorithms are flexible – they’re not tied to one particular application or problem domain.
So far, we’ve considered four data structures: arrays, lists, stacks, and queues. All four could be described as linear, in that they maintain their items as ordered sequences: arrays and lists are indexed by position, stacks are LIFO, and queues are FIFO. In this chapter, we’ll consider the new problem of building a lookup structure, like a table, that can take an input called the key and return its associated value. For example, we might fetch a record of information about a museum artifact given its ID number as the key. None of our previous data structures are a good fit for this problem.