
























Studia grazie alle numerose risorse presenti su Docsity
Guadagna punti aiutando altri studenti oppure acquistali con un piano Premium
Prepara i tuoi esami
Studia grazie alle numerose risorse presenti su Docsity
Prepara i tuoi esami con i documenti condivisi da studenti come te su Docsity
Trova i documenti specifici per gli esami della tua università
Preparati con lezioni e prove svolte basate sui programmi universitari!
Rispondi a reali domande d’esame e scopri la tua preparazione
Riassumi i tuoi documenti, fagli domande, convertili in quiz e mappe concettuali
Studia con prove svolte, tesine e consigli utili
Togliti ogni dubbio leggendo le risposte alle domande fatte da altri studenti come te
Esplora i documenti più scaricati per gli argomenti di studio più popolari
Ottieni i punti per scaricare
Guadagna punti aiutando altri studenti oppure acquistali con un piano Premium
prof simpatico ma complessita computazionale
Tipologia: Dispense
1 / 32
Questa pagina non è visibile nell’anteprima
Non perderti parti importanti!

























High Performance Computing 2024/
Computational Complexity The computational complexity , or simply complexity of an algorithm is the amount of resources required for running it. The computational complexity of a problem is the minimum of the complexities of all possible algorithms for this problem (including the unknown algorithms). A complexity class can be thought of as a collection of computational problems requiring O(f(n)) resources of an abstract machine for being solved, where n is the size of the input.
Decision Problems and Languages A decision problem is a YES-or-NO question about the input values. Solving a decision problem is equivalent to deciding the language L={x : f(x)=1} , where f() is the function that defines the problem. R = class of all languages decidable on some Turing machine. All the problems that belong to R are defined by computable functions f(). The halting problem is not in R. Most decision problems are not in R.
Upper Bounds vs Lower Bounds For a lot of problems, we don’t know the problem complexity, but we have bounds on it. We know the problem complexity falls between an upper bound and a lower bound. Discovery of better algorithms reduces the upper bound on the worst-case computational complexity.
Time vs Space Complexity Time complexity vs space complexity: TIME(f(n)) is the class of languages that are decidable by an O(f(n)) time deterministic Turing machine. SPACE(f(n)) is the class of languages that are decidable by an O(f(n)) space deterministic Turing machine. A time-efficient algorithm is one that runs in polynomial time , i.e., O(nk), in the size of the problem solved. An algorithm that requires super-polynomial (typically exponential) time to solve a problem is not time-efficient. Deterministic TM = classical computer.
Complexity Relationships Among Models The choice of computational model can affect the time complexity of languages. Theorem - Let f(n) be a function, where f(n) ≥ n. Then every f(n) time multitape Turing machine has an equivalent O(f^2 (n)) time single-tape Turing machine. Theorem - Let f(n) be a function, where f(n) ≥ n. Then every f(n) time nondeterministic single-tape Turing machine has an equivalent 2O(f(n)) time deterministic single-tape Turing machine.
P and EXP P is the class of languages that can be decided quickly (i.e., in polynomial time) on a classical computer. P is the union, over all positive integers k, of TIME(nk). In other words, it is the class of languages that are decidable in polynomial time on a deterministic Turing machine. Examples:
P/ f(n) P/f(n) is the class of languages that are decidable by a polynomial- time deterministic TM, given the input w of length n and an advice string c of length f(n). The advice string is just an extra input. P/poly --> the length of c is polynomial in n P/poly is important for several reasons. For example, in cryptography, security is often defined against P/poly adversaries.
NP A verifier for a language A is an algorithm V, where A = {w | V accepts ❬w,c❭ for some string c} We measure the time of a verifier only in terms of the length of w. NP is the class of languages that have polynomial time verifiers. This means that if someone gives us an instance of the problem and a certificate (sometimes called a proof) to the answer being YES, we can check that it is correct in polynomial time. NTIME(t(n)) is the class of languages that are decidable by an O(t(n)) time nondeterministic Turing machine. NP is the union, over all positive integers k, of NTIME(nk).
coNP coNP contains the languages that are complement of languages in NP. This means that if someone gives us an instance of the problem and a certificate to the answer being NO, we can check that it is correct in polynomial time. We don't know whether coNP is different from NP.
Polynomial-time Reducibility Polynomial-time reducibility allows us to classify problems according to relative difficulty. It is a special case of mapping reducibility. If A≤pB then A cannot be harder than B, because whenever an efficient algorithm exists for B, one exists for A as well. Conversely, if no efficient algorithm exists for A, none exists for B either. Example: finding the median reduces to sorting If A≤pB and B≤pA then A and B are computationally equivalent ( A ≣ pB ). Language A is polynomial-time reducible to language B, written A≤pB , if there is a polynomial-time computable function f, where for every w, w ∈ A f(w) ∈ B. The function f is called the polynomial-time reduction of A to B.
Hardness and Completeness Problem B is called C-Hard if for all problems A in C we have A≤pB. If we further have that B is in C , then B is called C-Complete. There are classes without complete problems. If C-Complete exists for C , its problems are the hardest problems in the class C. If we manage to solve one of them efficiently, we have done so automatically for all other problems in C. Instead, if we manage to solve efficiently a problem in C that is not C-Complete , we are still unable to solve efficiently the problems that are C-Complete. Problems in C-Hard are at least as hard as the hardest problems in C , (i.e., the C-Complete problems).
NP-Hard Language B is NP-Hard if any language A in NP is polynomial-time reducible to B. I.e., NP-Hard problems are at least as hard as any other problem in NP. The halting problem is not in NP , because it is not decidable in a finite number of operations. However, it is NP-Hard because all decidable problems can be reduced to the halting problem.
NP-Complete Language B is NP-Complete if it satisfies two conditions: