Skip to Content
Algorithms in a Nutshell
book

Algorithms in a Nutshell

by George T. Heineman, Gary Pollice, Stanley Selkow
October 2008
Intermediate to advanced
368 pages
10h 9m
English
O'Reilly Media, Inc.
Content preview from Algorithms in a Nutshell

Reporting

It is instructive to review the actual results when computed on the same platform, in this case a Linux 2.6.9-67.0.1.ELsmp i686 (this machine is different from the desktop PC and high-end computer mentioned earlier in this chapter). We present three tables (Tables A-3, A-5, and A-6), one each for Java, C, and Scheme. In each table, we present the millisecond results and a brief histogram table for the Java results.

Table A-3. Timing results of 30 computations in Java

n

average

min

max

stdev

#

1,000,000

8.5

8

18

0.5092

28

2,000,000

16.9643

16

17

0.1890

28

3,000,000

25.3929

25

26

0.4973

28

4,000,000

33.7857

33

35

0.4179

28

5,000,000

42.2857

42

44

0.4600

28

The aggregate behavior of Table A-3 is detailed in histogram form in Table A-4. We omit from the table rows that have only zero values; all nonzero values are shaded in the table.

Table A-4. Individual breakdowns of timing results

time (ms)

1,000,000

2,000,000

3,000,000

4,000,000

5,000,000

8

15

0

0

0

0

9

14

0

0

0

0

16

0

2

0

0

0

17

0

28

0

0

0

18

1

0

0

0

0

25

0

0

18

0

0

26

0

0

12

0

0

33

0

0

0

7

0

34

0

0

0

22

0

35

0

0

0

1

0

42

0

0

0

0

21

43

0

0

0

0

8

44

0

0

0

0

1

To interpret these results for Java, we turn to statistics. If we assume that the timing of each trial is independent, then we refer to the confidence intervals described earlier. If we are asked to predict the performance of a proposed run for n=4,000,000, ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.

Read now

Unlock full access

More than 5,000 organizations count on O’Reilly

AirBnbBlueOriginElectronic ArtsHomeDepotNasdaqRakutenTata Consultancy Services

QuotationMarkO’Reilly covers everything we've got, with content to help us build a world-class technology community, upgrade the capabilities and competencies of our teams, and improve overall team performance as well as their engagement.
Julian F.
Head of Cybersecurity
QuotationMarkI wanted to learn C and C++, but it didn't click for me until I picked up an O'Reilly book. When I went on the O’Reilly platform, I was astonished to find all the books there, plus live events and sandboxes so you could play around with the technology.
Addison B.
Field Engineer
QuotationMarkI’ve been on the O’Reilly platform for more than eight years. I use a couple of learning platforms, but I'm on O'Reilly more than anybody else. When you're there, you start learning. I'm never disappointed.
Amir M.
Data Platform Tech Lead
QuotationMarkI'm always learning. So when I got on to O'Reilly, I was like a kid in a candy store. There are playlists. There are answers. There's on-demand training. It's worth its weight in gold, in terms of what it allows me to do.
Mark W.
Embedded Software Engineer

You might also like

Algorithms in a Nutshell, 2nd Edition

Algorithms in a Nutshell, 2nd Edition

George T. Heineman, Gary Pollice, Stanley Selkow
Dive Into Algorithms

Dive Into Algorithms

Bradford Tuckfield

Publisher Resources

ISBN: 9780596516246Catalog PageErrata