12.07.2015 Views

A Practical Introduction to Data Structures and Algorithm Analysis

A Practical Introduction to Data Structures and Algorithm Analysis

A Practical Introduction to Data Structures and Algorithm Analysis

SHOW MORE
SHOW LESS
  • No tags were found...

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Sec. 1.2 Abstract <strong>Data</strong> Types <strong>and</strong> <strong>Data</strong> <strong>Structures</strong> 11Example 1.6 When operating a car, the primary activities are steering,accelerating, <strong>and</strong> braking. On nearly all passenger cars, you steer by turningthe steering wheel, accelerate by pushing the gas pedal, <strong>and</strong> brake bypushing the brake pedal. This design for cars can be viewed as an ADTwith operations “steer,” “accelerate,” <strong>and</strong> “brake.” Two cars might implementthese operations in radically different ways, say with different typesof engine, or front- versus rear-wheel drive. Yet, most drivers can operatemany different cars because the ADT presents a uniform method ofoperation that does not require the driver <strong>to</strong> underst<strong>and</strong> the specifics of anyparticular engine or drive design. These differences are deliberately hidden.The concept of an ADT is one instance of an important principle that must beunders<strong>to</strong>od by any successful computer scientist: managing complexity throughabstraction. A central theme of computer science is complexity <strong>and</strong> techniquesfor h<strong>and</strong>ling it. Humans deal with complexity by assigning a label <strong>to</strong> an assemblyof objects or concepts <strong>and</strong> then manipulating the label in place of the assembly.Cognitive psychologists call such a label a metaphor. A particular label might berelated <strong>to</strong> other pieces of information or other labels. This collection can in turn begiven a label, forming a hierarchy of concepts <strong>and</strong> labels. This hierarchy of labelsallows us <strong>to</strong> focus on important issues while ignoring unnecessary details.Example 1.7 We apply the label “hard drive” <strong>to</strong> a collection of hardwarethat manipulates data on a particular type of s<strong>to</strong>rage device, <strong>and</strong> we applythe label “CPU” <strong>to</strong> the hardware that controls execution of computerinstructions. These <strong>and</strong> other labels are gathered <strong>to</strong>gether under the label“computer.” Because even small home computers have millions of components,some form of abstraction is necessary <strong>to</strong> comprehend how a computeroperates.Consider how you might go about the process of designing a complex computerprogram that implements <strong>and</strong> manipulates an ADT. The ADT is implemented inone part of the program by a particular data structure. While designing those partsof the program that use the ADT, you can think in terms of operations on the datatype without concern for the data structure’s implementation. Without this ability<strong>to</strong> simplify your thinking about a complex program, you would have no hope ofunderst<strong>and</strong>ing or implementing it.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!