1. Trang chủ
  2. » Công Nghệ Thông Tin

algorithms in a nutshell

344 270 0

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

THÔNG TIN TÀI LIỆU

[...]... throughout this chapter (and indeed throughout the entire book) is that all assumptions and approximations may be off by a constant, and ultimately our abstraction will ignore these constants For all algorithms covered in this book, the constants are small for virtually all platforms Size of a Problem Instance An instance of a problem is a particular input data set to which a program is applied In most problems,... differences in programming languages and computer platforms on which programs execute, algorithmic researchers accept that they are unable to compute with pinpoint accuracy the costs involved in using a particular encoding in an implementation Therefore, they assert that performance costs that differ by a multiplicative constant are asymptotically equivalent Although such a definition would be impractical for... advantage of specific information about a problem to improve performance Second, we also describe throughout the book different algorithms and explain why one algorithm outperforms another We return again and again to empirically support these mathematical claims Side Story | 9 Algorithms in a Nutshell Algorithms in a Nutshell By Gary Pollice, George T Heineman, Stanley Selkow ISBN: Prepared for Ming... libraries that no one was willing to use it We’re talking really slow here You could start up a program, go have a cup of coffee—or maybe a pot of coffee—come back, and the program would still be crawling along This was clearly unacceptable * The names of participants and organizations, except the authors, have been changed to protect the innocent and avoid any embarrassment—or lawsuits :-) 3 Algorithms. .. question, and one that we’ll answer by asking another question: does it really matter? Finding the right algorithm is like finding the right solution to any problem Instead of finding the perfect solution, the algorithm just has to 10 | Chapter 1: Algorithms Matter Algorithms in a Nutshell Algorithms in a Nutshell By Gary Pollice, George T Heineman, Stanley Selkow ISBN: Prepared for Ming Yi, Safari ID:... which algorithm will be fastest for a particular data set on a particular platform (or family of platforms) Characterizing the expected computation time of an algorithm is inherently a mathematical process In this chapter we present the mathematical tools behind this prediction of time Readers will be able to understand the various mathematical terms throughout this book after reading this chapter A common... creative people, Graham was already thinking about his next program and didn’t want to go back to his memory leak program to find out what was wrong So, he asked Gary to take a look at it and see whether he could fix it Gary was more of a compiler and software engineering type of guy and seemed to be pretty good at honing code to make it release-worthy Gary thought he’d talk to Graham about the program... applicable laws All rights reserved Algorithms in a Nutshell Page 14 Return to Table of Contents Gary asked Graham how he kept track of the allocated memory Graham replied that he was using a binary tree where each node was a structure that consisted of pointers to the children nodes (if any), the address of the allocated memory, the size allocated, and the place in the program where the allocation... applicable laws All rights reserved Algorithms in a Nutshell Return to Table of Contents Page 24 The Math of Algorithms Figure 2-2 Comparing four sort algorithms on small data sets regression analysis The “fitness” of a trend line to the actual data is based on a value between 0 and 1, known as the R2 value Values near 1 indicate a high fitness For example, if R2 = 0.9948, there is only a 0.52% chance... conclusion to draw is that for many problems, no single optimal algorithm exists Choosing an algorithm depends on understanding the problem being solved and the underlying probability distribution of the instances likely to be treated, as well as the behavior of the algorithms being considered Analysis in the Best, Average, and Worst Cases | 19 Algorithms in a Nutshell Algorithms in a Nutshell By Gary Pollice, . outperforms another. We return again and again to empirically support these mathematical claims. Algorithms in a Nutshell Page 16 Return to Table of Contents Algorithms in a Nutshell Algorithms in a Nutshell. designations appear in this book, and O’Reilly Media, Inc. was aware of a trademark claim, the designations have been printed in caps or initial caps. While every precaution has been taken in the. RepKover ™ , a durable and flexible lay-flat binding. ISBN: 978-0-596-51624-6 [M] Algorithms in a Nutshell Page 1 Return to Table of Contents Algorithms in a Nutshell Algorithms in a Nutshell By Gary

Ngày đăng: 01/08/2014, 16:19

Xem thêm: algorithms in a nutshell

Mục lục

    The Moral of the Story

    The Mathematics of Algorithms

    Size of a Problem Instance

    Rate of Growth of Functions

    Analysis in the Best, Average, and Worst Cases

    Patterns: A Communication Language

    Choosing a Programming Language

    Criteria for Choosing a Sorting Algorithm

    All Pairs Shortest Path

    Minimum Spanning Tree Algorithms

TÀI LIỆU CÙNG NGƯỜI DÙNG

  • Đang cập nhật ...

TÀI LIỆU LIÊN QUAN