You are on page 1of 2

Design and Analysis of Algorithms

Assignment#4

Таsk 1. There is a discretely controlled system Ω1, the graph G(Ω1) that defines it is
shown in fig. 1.1. The initial state is 0, the set of final states is singleton: F = {9}. Using the
direct counting method, it is required to find the complete trajectory of the minimum cost.

1
Рис. 1.1. Граф G(Ω )

For the states of the system Ω1 (the vertices of the graph G(Ω1)) we calculate the values of the
Bellman function. Based on (1.1), we fix В(9) = 0.
Таsk 2. Consider the following two problems:
(1) The problem Hamiltonian cycle: Given an undirected graph G = (V,E), does it have a
Hamiltonian cycle, i.e., a cycle that visits each vertex exactly once?

Hint 1: For Hamiltonian cycle problem by using Dynamic Programming, you can use
as a reference, the following tutorial:
Lecture Notes Series on Computing - Vol. 14 / Algorithms
Design Techniques and Analysis - M. H. Alsuwaiyel

Таsk 3. Chromatic number. Given an undirected graph G = (V,E) and a positive integer k, is
k the smallest number of colors that can be assigned to the vertices of G such that no two
adjacent vertices are assigned the same color? Recall that the problem coloring stated on page
248 is the problem of deciding whether it is possible to color a given graph using k colors, where
k is a positive number that is part of the input. It is well known that the problem coloring is NP-
complete. An algorithm to accept chromatic number using an oracle for coloring is as follows.
(1) If (G,k) is not in coloring then stop and reject, otherwise continue.
(2) If (G,k − 1) is in coloring then stop and reject, otherwise continue.
(3) Stop and accept.
We observe that checking whether (G,k) is in coloring is implemented by asking the oracle
coloring and is answered in one step, by assumption. So, the algorithm presented above is
clearly polynomial time bounded, since it needs at most two steps to either accept or reject. It
follows that chromatic number = PNP.

Hint 2: For Chapter 10 Introduction to Computational Complexity


The Polynomial Time Hierarchy, you can use as a reference, the following tutorial:
Lecture Notes Series on Computing - Vol. 14 / Algorithms
Design Techniques and Analysis - M. H. Alsuwaiyel

Таsk 4. The input is N integers, as well as a set of M requests, each of which is an


integer. Your task is for each query to find the number of numbers from the original set that are
less than the number specified in the query. Using the built-in binary search functions is
prohibited.
Sources
en.cppreference.com/w/cpp/algorithm
en.cppreference.com/w/cpp/language/lambda

You might also like