# Chapter22 - CHAPTER The Cost of Computing Introduction A book about computing would be incomplete without summarizing what computer programs can

This preview shows pages 1–3. Sign up to view the full content.

571 Introduction A book about computing would be incomplete without summarizing what computer programs can and cannot do. As the chapters progressed, we discussed a number of data collections and a number of operations on those data collections. In Chapter 16 we also discussed Big O, the basic technique for evaluating the computing cost of an algorithm. In this chapter, first we will summarize the computing cost of the classic operation types on the several data collections. Then we will discuss in general the subject of computability, and will conclude with a discussion of a very special class of problem—the N-P Complete problem. The Cost of Computing CHAPTER 22 22.1 Algorithms Operating on Collections 22.2 Algorithm Performance Categories 22.2.1 Polynomial Algorithms 22.2.2 O(2 N ) 22.2.3 O(N!) 22.3 Unreasonable Algorithms 22.4 Tractability of Problems 22.4.1 Definitions 22.4.2 Closed versus Open Problems 22.4.3 More Definitions 22.5 N-P Complete Problems 22.5.1 Yet More Definitions 22.5.2 Illustrations 22.5.3 The Opportunity

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
572 Chapter 22 The Cost of Computing 22.1 Algorithms Operating on Collections Table 22.1 illustrates the Big O performance of the most common operations we have discussed on the common data collections. In summary, any traversal, mapping, folding, or filtering is O(N) because all the data items have to be touched to perform these operations. Inserting (the critical component of building) into unstructured collections is usually O(1) because it does not matter where in the collection the new data are placed. Searching is O(N) unless the structure facilitates a binary search, and sorting is O(N log N) unless the structure cannot support random access, in which case insertion sort must be used with O(N 2 ). The X symbols indicate that the operation is not defined for this collection. 22.2 Algorithm Performance Categories As we discussed in Chapter 16 while presenting the Big O discussion, the performance of algorithms really does not matter for small amounts of data. However, in the information age in which we now live, we are confronted daily with enormous amounts of data, and computer scientists are busy polishing algorithms to process these massive amounts of data efficiently. For example, it is only in recent years that the telephone company has made national telephone directories searchable. Before, you had to know the area code before you could ask for a person’s phone number because the national listing was too cumbersome to search. Even with the best algorithms available, however, there are cases where exact solutions are not computable in reasonable amounts of time. 22.2.1 Polynomial Algorithms We tend to think of algorithms where the Big O has N to a constant power as being “OK.” However, consider some algorithm that is O(N 5 ). With 256 items of data and a processor, the computer performs one operation in a Operation Insert Traverse Filter Map Search Sort Fold N N N N Log N 1 N N N N N Log N N N Log N N 1 X N N X X N 1 N X N N X N Log N N N N Log N X N X N X N N X N X X X X N X X 1 N N N N N 2 N Array Sorted
This is the end of the preview. Sign up to access the rest of the document.

## This note was uploaded on 11/21/2011 for the course CS 1371 taught by Professor Stallworth during the Fall '08 term at Georgia Institute of Technology.

### Page1 / 8

Chapter22 - CHAPTER The Cost of Computing Introduction A book about computing would be incomplete without summarizing what computer programs can

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document
Ask a homework question - tutors are online