Definitions
A
Algorithm
An algorithm is a procedure to accomplish a specific task, namely a well-specified problem, where the problem is specified by describing the complete set of instances it must work on and of its output after running on one of these instances.
The distinction between a problem and an instance of a problem is critical. Determining that you are dealing with a general problem instead of an instance is your first step towards solving it.
There are three desirable properties for a good algorithm. We seek algorithms that are
- correct
- efficient
- easy to implement
Correctness may be formally verified by means of a proof (e.g., induction, contradiction, etc.) while efficiency is typically analyzed and established by means of Big- notation.
API wrapper
From Quora: An API-wrapper typically takes an API in one form and transforms it into another.
An example might be useful:
The main application interface to Flickr (the image hosting service) is a REST api (is http GET or POST calls). There is a library called pyFlickr which is a API-wrapper — it provides a Pythonic interface to Flickr — classes, methods, iterators using the REST API under the skin. It keeps all of the REST api methods intact and available, but you call them using Python function calls and wrappings.
Sometimes you will see the term binding, as in a Python binding for xyz; essentially this is different form of API-wrapper. Here the wrapper transforms an API designed for one programming language and provides functionality in a second language to call the original API. An example here is pyGTK. The original gtk api is written a a C library. pyGTK is called a Python binding for gtk as it allows a Python program to call the gtk API written in C.
B
Big Oh
Controlled chaos: notation significantly simplifies calculations because it allows us to be sloppy — but in a satisfactorily controlled way. [4]
Need for and : As noted in [10], Big- notation is used extensively to describe the growth of functions, but it has limitations. In particular, when is , we have an upper bound, in terms of , for the size of for large values of . However, big- notation does not provide a lower bound for the size of for large . For this, we use big-Omega notation. When we want to give both an upper and a lower bound on the size of the function , relative to a reference function , we use big-Theta notation. Both big-Omega and big-Theta notation were introduced by Donald Knuth in the 1970s. His motivation for introducing these notations was the common misuse of big- notation when both an upper and a lower bound on the size of a function are needed.
The definitions that follow may be found in [10].
Worst case (big-O)
Let and be functions from the set of integers or the set of real numbers to the set of real numbers. We say that is if there are constants and such that
whenever . This reads as, " is big-oh of ," and is sometimes represented as even though usage of =
is more colloquial than anything.
Example illustrating definition
Problem: Show that is .
Solution: We observe that we can readily estimate the size of when because and when . It follows that
whenever . Consequently, we can take and as witnesses to show that is . That is, whenever . (Note that it is not necessary to use absolute values here because all functions in the equalities are positive when is positive.)
Alternatively, we can estimate the size of when . When , we have and . Consequently, if , we have
It follows that and are also witnesses to the relation is .
Observe that in the relationship is , can be replaced by any function with larger values than . For example, is , is , and so on.
It is also true that is , because whenever . This means that and are witnesses to the relationship is . See [10] for more details.
As noted in [4], mathematicians customarily use the =
sign as they use the word "is" in English: Aristotle is a man, but a man isn't necessarily Aristotle. Hence, in discussions of big oh, it is worth noting that the equality sign is not symmetric with respect to such notations; we have and but not , nor can we say that .
The definition above may be expressed more formally in the language of quantifiers as follows:
The constants and in the definition of big- notation above are called witnesses to the relationship " is ". To establish that is we need only one pair of witnesses to this relationship. That is, to show that is , we need find only one pair of constants and , the witnesses, such that whenever .
Note that when there is one pair of witnesses to the relationship is , there are infinitely many pairs of witnesses. To see this, note that if and are one pair of witnesses, then any pair and , where and , is also a pair of witnesses, since whenever .
A useful approach for finding a pair of witnesses is to first select a value of for which the size of can be readily estimated when and to see whether we can use the estimate to find a value of for which for .
Best case (big-Ω)
Let and be functions from the set of integers or the set of real numbers to the set of real numbers. We say that is if there are positive constants and such that
whenever . This reads as, " is big-Omega of ," and is sometimes represented as . This definition may be expressed more formally in the language of quantifiers as follows:
Average case (big-Θ)
Let and be functions from the set of integers or the set of real numbers to the set of real numbers. We say that is if is and is . This reads as, " is big-Theta of ," and is sometimes represented as . We also say that is of order . This definition, in light of the previous definitions for big- and big-, may be expressed more formally in the language of quantifiers as follows:
C
D
E
F
G
H
I
J
K
L
M
Math
Logarithms
- means
Modular arithmetic
Sequences and series
Arithmetic
Arithmetic sequence
An arithmetic sequence is a sequence of the form
The number is the first term, and is the common difference of the sequence. The th term of an arithmetic sequence is given by
Partial sums of an arithmetic sequence
For the arithmetic sequence , the th partial sum
is given by either of the following formulas:
Geometric
Geometric sequence
A geometric sequence is a sequence of the form
The number is the first term, and is the common ratio of the sequence. The th term of a geometric sequence is given by
Partial sums of a geometric sequence
For the geometric sequence , the th partial sum
is given by
Sum of an infinite geometric series
If , then the infinite geometric series
has the sum
Sums
Powers of integers
N
O
P
Path (graph theory)
A path is a trail in which all vertices (and therefore also all edges) are distinct.
Q
R
S
T
Time-sharing (computing)
Time-sharing is the ability for multiple users to share access to a single computer’s resources.
An Ars Technica article on the history of Linux also mentions time-sharing: "Thus [due to costs associated with operating and owning the GE 645], there was widespread interest in time sharing, which allowed multiple researchers to run programs on the mainframe at the same time, getting results immediately on their remote terminals. With time sharing, the programs weren’t printed off on punch cards, they were written and stored on the mainframe. In theory, researchers could write, edit, and run their programs on the fly and without leaving their offices. Multics was conceived with that goal in mind. It kicked off in 1964 and had an initial delivery deadline of 1967."
Trail (graph theory)
A trail is a walk in which all edges are distinct.
U
V
W
Walk (graph theory)
A walk is a finite or infinite sequence of edges which joins a sequence of vertices.
Let be a graph. A finite walk is a sequence of edges for which there is a sequence of vertices such that for . is the vertex sequence of the walk. The walk is closed if and it is open otherwise. An infinite walk is a sequence of edges of the same type described here, but with no first or last vertex, and a semi-infinite walk (or ray) has a first vertex but no last vertex.