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...

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

8File Processing <strong>and</strong> ExternalSortingEarlier chapters presented basic data structures <strong>and</strong> algorithms that operate on datas<strong>to</strong>red in main memory. Some applications require that large amounts of informationbe s<strong>to</strong>red <strong>and</strong> processed — so much information that it cannot all fit in<strong>to</strong> mainmemory. In that case, the information must reside on disk <strong>and</strong> be brought in<strong>to</strong> mainmemory selectively for processing.You probably already realize that main memory access is much faster than access<strong>to</strong> data s<strong>to</strong>red on disk or other s<strong>to</strong>rage devices. The relative difference in accesstimes is so great that efficient disk-based programs require a different approach <strong>to</strong>algorithm design than most programmers are used <strong>to</strong>. As a result, many programmersdo a poor job when it comes <strong>to</strong> file processing applications.This chapter presents the fundamental issues relating <strong>to</strong> the design of algorithms<strong>and</strong> data structures for disk-based applications. 1 We begin with a descriptionof the significant differences between primary memory <strong>and</strong> secondary s<strong>to</strong>rage.Section 8.2 discusses the physical aspects of disk drives. Section 8.3 presents basicmethods for managing buffer pools. Section 8.4 discusses the Java model forr<strong>and</strong>om access <strong>to</strong> data s<strong>to</strong>red on disk. Section 8.5 discusses the basic principles forsorting collections of records <strong>to</strong>o large <strong>to</strong> fit in main memory.1 Computer technology changes rapidly. I provide examples of disk drive specifications <strong>and</strong> otherhardware performance numbers that are reasonably up <strong>to</strong> date as of the time when the book waswritten. When you read it, the numbers might seem out of date. However, the basic principles do notchange. The approximate ratios for time, space, <strong>and</strong> cost between memory <strong>and</strong> disk have remainedsurprisingly steady for over 20 years.279

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

Saved successfully!

Ooh no, something went wrong!