14.07.2013 Views

dissertacao.pdf

dissertacao.pdf

dissertacao.pdf

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

1.5.2 Time Complexity<br />

In cryptography, rather than the value of an integer, it is common to work with<br />

its size in bits. Most of the algorithms presented in this work will depend on<br />

the size of integers, so it is convenient to present firstly the following definition:<br />

Definition 3. The size of N is the number of bits it takes to represent N in<br />

base 2, namely log 2(N)<br />

Throughout the rest of this work, when referring to the size of a number,<br />

log(N) should be considered log 2(N). To describe an algorithm’s efficiency we<br />

usually relate its running time to some class of functions, for which we use the<br />

following notation:<br />

Definition 4. Big-O notation: Given two functions f and g, we say that<br />

f(n) ∈ O(g(n)) iff:<br />

∃ constants c, n0 > 0 : ∀n ≥ n0 we have 0 ≤ f(n) ≤ cg(n) (1)<br />

This means that, for sufficiently large values of n, the function f does not<br />

exceed g.<br />

The efficiency of the algorithms will be described in terms of the number of<br />

basic operations it executes in function of the input given.<br />

Definition 5. The running time of an algorithm A, TA(n) is the number<br />

of elementary instructions it executes when the input data is n. Occasionally,<br />

the running time can depend on more than one parameter. When the situation<br />

will be clear, we will simply say that the running time of an algorithm A<br />

is O(f), meaning that TA(n) ∈ O(f(n)).<br />

It is obvious that each function does not belong to a single class of complex-<br />

ity.For example, if T (n) ∈ O(f(n)), then obviously T (n) ∈ O(2f(n)). For this<br />

reason, when saying that T (n) ∈ O(f(n)) we mean that f is the smallest known<br />

function that satisfies this, unless otherwise stated.<br />

Here are some simple cases for the complexity of an algorithm A, TA(n):<br />

1. TA(n) is O(log(n) α ) means that the running time of A is polynomial in<br />

the size of its input.<br />

2. TA(n) is O(β log(n) ) means that the running time of A is exponential in<br />

the size of its input.<br />

6

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!