Physics
Physics, 24.03.2021 18:10, cbogrett

Recall that a palindrome is any string that is exactly the same as its reversal, like I, or DEED, or RACECAR, or . For technical reasons, in this problem, we will only be interested in palindromes that are of length at least one, hence we will not treat the string as a palindrome. Any string can be decomposed into a sequence of palindrome substrings. For example, the string
BUBBASEESABANANA ("Bubba sees a banana.") can be broken into palindromes in the following ways (among many others):
BUB BASEESAB ANANA
B U B B A S E E S A B ANA N A
B U B B A S E E S A B A N A N A
Since any string w can always be decomposed to palindromes we may want to find a de- composition that optimizes some objective. Here are two example objectives. The first objective is to decompose w into the smallest number of palindromes. A second objective is to find a decomposition such that each palindrome in the decomposition has length at least k where k is some given input parameter. Both of these can be cast as special cases of an abstract problem Suppose we are given a function called cost) that takes a positive integer h as input and outputs an integer cost(h). Given a decomposition of w into u1,U2,...,ur (that is, w uUur) we can define the cost of the decomposition as Σί-i cost(w)
For example if we define cost(h) - 1 for all h 2 1 then finding a minimum cost palindromic decomposition of a given string w is the same as finding a decomposition of w with as few palindromes as possible. Suppose we define cost) as follows: cost(h) - 1 for h < k and cost(h)-0 for h 2 k. Then finding a minimum cost palindromic decomposition would enable us to decide whether there is a decomposition in which all palindromes are of length at least k; it is possible iff the minimum cost is 0.
Describe an efficient algorithm that given black box access to a function cost), and a string w outputs the value of a minimum cost palindromic decomposition of w.

answer
Answers: 2

Other questions on the subject: Physics

image
Physics, 22.06.2019 05:30, Lizethh1
Física: un futbolista patea hacia el arco con una velocidad de 15m/ah, calcular: a)el alcance para un ángulo de tiro de 25? , b) el tiempo que el balón permanece en el aire.
Answers: 3
image
Physics, 22.06.2019 14:20, jeny89
4r-134a enters the condenser of a residential heat pump at 800 kpa and 50°c at a rate of 0.022 kg/s and leaves at 750 kpa subcooled by 3°c. the refrigerant enters the compressor at 200 kpa superheated by 4°c determine (a) the isentropic efficiency of the compressor, (b) the rate of heat supplied to the heated room, and (c) the cop of the heat pump. also, determine (d) the cop and rate of heat supplied to the heated room if this heat pump operated on the ideal vapor-compression cycle between the pressure limits of 200 and 800 kpa. (0.757, 4.37 kw, 5.12, 6.18, 3.91 kw)
Answers: 3
image
Physics, 22.06.2019 16:00, postorivofarms
The process of predicting values that extend beyond the range of data points is called absolute value extrapolation interpolation prediction for any given: )
Answers: 2
image
Physics, 22.06.2019 17:30, RegencySlayer5304
Alarge cruise ship of mass 7.00 ✕ 107 kg has a speed of 11.6 m/s at some instant. (a) what is the ship's kinetic energy at this time? (b) how much work is required to stop it? (give the work done on the ship. include the sign of the value in your answer.) (c) what is the magnitude of the constant force required to stop it as it undergoes a displacement of 3.00 km?
Answers: 2
Do you know the correct answer?
Recall that a palindrome is any string that is exactly the same as its reversal, like I, or DEED, or...

Questions in other subjects:

Konu
Mathematics, 01.09.2021 03:50
Konu
Mathematics, 01.09.2021 03:50
Konu
Mathematics, 01.09.2021 03:50