We use cookies to distinguish you from other users and to provide you with a better experience on our websites. Close this message to accept cookies or find out how to manage your cookie settings.
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.
No other computational problem has been studied in more depth, or yielded a greater number of useful solutions, than sorting. Historically, business computers spent 25% of their time doing nothing but sorting data (Knuth, 2014c), and many advanced algorithms start by sorting their inputs. Dozens of algorithms have been proposed over the last 80-odd years, but there is no “best” solution to the sorting problem. Although many popular sorting algorithms were known as early as the 1940s, researchers are still designing improved versions – Python’s default algorithm was only implemented in the early 2000s and Java’s current version in the 2010s.
This chapter describes the features that are common to most clinical interventions, focusing primarily on psychotherapy. It examines what psychotherapy actually is like and contrasts that description with how therapy is portrayed in popular media. It includes a description of the participants in psychotherapy and what research tells us about clients and therapists and which of their characteristics influence therapy outcomes. Next comes a summary of the goals and basic processes involved in clinical interventions, as well as the professional and ethical codes that help guide practitioners in conducting treatment in the most professional fashion. The chapter ends with a description of practical aspects of treatment such as duration, fees, record keeping, treatment planning, therapist self-disclosure, and termination.
Computer animators have always sought to push boundaries and create impressive, realistic visual effects, but some processes are too demanding to model exactly. Effects like fire, smoke, and water have complex fluid dynamics and amorphous boundaries that are hard to recreate with standard physical calculations. Instead, animators might turn to another approach to create these effects: particle systems. Bill Reeves, a graphics researcher and animator, began experimenting with particle-based effects in the early 1980s while making movies at Lucasfilm. For a scene in Star Trek II: The Wrath of Khan (1982), he needed to create an image of explosive fire spreading across the entire surface of a planet. Reeves used thousands of independent particles, each one representing a tiny piece of fire (Reeves, 1983). The fire particles were created semi-randomly, with attributes for their 3D positions, velocities, and colors. Reeves’ model governed how particles appeared, moved, and interacted to create a realistic effect that could be rendered on an early 1980s computer. Reeves would go on to work on other Lucasfilm productions, including Return of the Jedi (1983), before joining Pixar, where his credits include Toy Story (1995) and Finding Nemo (2003).
Java is an object-oriented programming language. Java programs are implemented as collections of classes and objects that interact with each other to deliver the functionality that the programmer wants. So far, we’ve used “class” as being roughly synonymous with “program,” and all of our programs have consisted of one public class with a main method that may call additional methods. We’ve also talked about how to use the new keyword to initialize objects like Scanner that can perform useful work. It’s now time to talk about the concepts of objects and classes in more depth and then learn how to write customized classes.
The previous two chapters showed how the concept of last-in-first-out data processing is surprisingly powerful. We’ll now consider the stack’s counterpart, the queue. Like a waiting line, a queue stores a set of items and returns them in first-in-first-out (FIFO) order. Pushing to the queue adds a new item to the back of the line and pulling retrieves the oldest item from the front. Queues have a lower profile than stacks, and are rarely the centerpiece of an algorithm. Instead, queues tend to serve as utility data structures in a larger system.
A hash, in culinary terms, is a dish made of mixed foods – often including corned beef and onions – chopped into tiny pieces. In the early twentieth century, it became a shorthand for something of dubious origin, probably unwise to consume. In computer science, a hash function is an operation that rearranges, mixes, and combines data to produce a single fixed-size output. Unlike their culinary namesake, hash functions are wonderfully useful. A hash value is like a “fingerprint” of the input used to calculate it. Hash functions have applications to security, distributed systems, and – as we’ll explore – data structures.