Skip to main content
Top

2014 | OriginalPaper | Chapter

2. The Basics

Author : Magnus Lie Hetland

Published in: Python Algorithms

Publisher: Apress

Activate our intelligent search to find suitable subject content or patents.

search-config
loading …

Abstract

■■■

Dont have a licence yet? Then find out more about our products and how to get one now:

Springer Professional "Wirtschaft+Technik"

Online-Abonnement

Mit Springer Professional "Wirtschaft+Technik" erhalten Sie Zugriff auf:

  • über 102.000 Bücher
  • über 537 Zeitschriften

aus folgenden Fachgebieten:

  • Automobil + Motoren
  • Bauwesen + Immobilien
  • Business IT + Informatik
  • Elektrotechnik + Elektronik
  • Energie + Nachhaltigkeit
  • Finance + Banking
  • Management + Führung
  • Marketing + Vertrieb
  • Maschinenbau + Werkstoffe
  • Versicherung + Risiko

Jetzt Wissensvorsprung sichern!

Springer Professional "Technik"

Online-Abonnement

Mit Springer Professional "Technik" erhalten Sie Zugriff auf:

  • über 67.000 Bücher
  • über 390 Zeitschriften

aus folgenden Fachgebieten:

  • Automobil + Motoren
  • Bauwesen + Immobilien
  • Business IT + Informatik
  • Elektrotechnik + Elektronik
  • Energie + Nachhaltigkeit
  • Maschinenbau + Werkstoffe




 

Jetzt Wissensvorsprung sichern!

Springer Professional "Wirtschaft"

Online-Abonnement

Mit Springer Professional "Wirtschaft" erhalten Sie Zugriff auf:

  • über 67.000 Bücher
  • über 340 Zeitschriften

aus folgenden Fachgebieten:

  • Bauwesen + Immobilien
  • Business IT + Informatik
  • Finance + Banking
  • Management + Führung
  • Marketing + Vertrieb
  • Versicherung + Risiko




Jetzt Wissensvorsprung sichern!

Footnotes
1
The Entscheidungsproblem is a problem posed by David Hilbert, which basically asks whether an algorithm exists that can decide, in general, whether a mathematical statement is true or false. Turing (and Alonzo Church before him) showed that such an algorithm cannot exist.
 
2
There are also Turing machines that don’t solve any problems—machines that simply never stop. These still represent what we might call programs, but we usually don’t call them algorithms.
 
3
Because input and output are of the same type, we could actually just specify a relation between A and A.
 
4
For an “out-of-the-box” solution for inserting objects at the beginning of a sequence, see the black-box sidebar on deque in Chapter 5.
 
5
For the “Cubic” and “Polynomial” row, this holds only when k ≥ 3.
 
6
Interestingly, once a problem is shown to have a polynomial solution, an efficient polynomial solution can quite often be found as well.
 
7
I’m using lg rather than log here, but either one is fine.
 
8
If the elements are ints, the running time of each += is constant. However, Python also support big integers, or longs, which automatically appear when your integers get big enough. This means you can break the constant-time assumption by using really huge numbers. If you’re using floats, that won’t happen (but see the discussion of float problems near the end of the chapter).
 
9
Spoiler: The complexity of this example is still Θ(n 2).
 
12
No, not the network kind, which is discussed later in this chapter. The other kind—plots of some measurement for every value of some parameter.
 
13
With IDREFs and symlinks, respectively, XML documents and directory hierarchies are actually general graphs.
 
14
Sets were introduced in Python 2.3, in the form of the sets module. The built-in set type has been available since Python 2.4.
 
15
This, a dictionary with adjacency lists, is what Guido van Rossum uses in his article “Python Patterns—Implementing Graphs,” which is found online at https://www.python.org/doc/essays/graphs/ .
 
16
This expression is guaranteed to work from Python 2.6 onward. In earlier versions, special floating-point values were platform-dependent, although float('inf') or float('Inf') should work on most platforms.
 
17
That is, the comments are inadequate and are presented to demonstrate the problem with most explanations.
 
18
This kind of trouble has led to disaster more than once (see, for example, www.ima.umn.edu/∼arnold/455.f96/disasters.html).
 
20
Sage is a tool for mathematical computation in Python and is available from http://sagemath.org .
 
Metadata
Title
The Basics
Author
Magnus Lie Hetland
Copyright Year
2014
Publisher
Apress
DOI
https://doi.org/10.1007/978-1-4842-0055-1_2

Premium Partner