subject
Computers and Technology, 27.04.2021 14:40 joey333

A dealer produces a sequence s1, . . . , sn of cards, face up, where each card si has value vi. Then two players take turns picking a card from the sequence, but can only pick the first or the last card of the (remaining) sequence. The goal is to collect cards of largest total value. (For example, you can think of the cards as bills of different denominations.) Assume n is even. (a) Consider a greedy approach for the first player: always picking up the available card of larger value. Give a sequence of cards such that is not optimal for the first player. Explain what the greedy approach will give you and what a better solution is. (b) GiveanO(n2).Giventheinitialsequence , your algorithm should precompute in O(n2) time some information, and then the first player should be able to make each move optimally in O(1) time by looking up the precomputed information.

ansver
Answers: 1

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 09:00
Designing a mobile web page is a little different from designing a regular web page. name at least three features that should be considered when designing a website that is mobile phone-friendly, and briefly explain why they are important.
Answers: 1
question
Computers and Technology, 22.06.2019 18:00
Budgets you to do all of the following expect a) send frivolously b) avoid over spending c) gain financial independence d) examine your priorities and goals
Answers: 2
question
Computers and Technology, 23.06.2019 01:00
Petrică, tânăr licean în clasa a ix-a, a primit în dar de la părinţii săi un cont bancar pentru micile sale cheltuieli curente. el este pasionat de internet banking şi îşi verifică cu grijă toate tranzacţiile efectuate. pentru creşterea securităţii tranzacţiilor online, banca îi furnizează lui petrică un număr pe care el va trebui să îl modifice, obţinând un număr tan – număr de autentificare a tranzacţiei (transaction authentication number). regula de obţinere a numărului tan este următoarea: se formează cel mai mic număr par din toate cifrele numărului furnizat de bancă. cerinţă cunoscând numărul n furnizat de bancă, să se determine numărul tan obţinut de petrică. date de intrare fişierul tan.in conţine pe prima linie numărul natural n cu semnificaţia din enunţ. date de ieşire fişierul de ieşire tan.out va conţine o singură linie pe care va fi scris numărul tan cerut. restricţii • 0 < n < 18*1018 • n are cel puţin o cifră pară • numărul tan obţinut nu poate conţine zerouri nesemnificative
Answers: 2
question
Computers and Technology, 23.06.2019 14:30
Select the correct answer. a company wants to use online methods to target more customers. it decides to conduct a market research by collecting the data of a few customers with their consent. they want to track data of the sites that their customers frequently visit. which software can the company? a. spyware b. bots c. adware d. trojan horse e. rootkits
Answers: 1
You know the right answer?
A dealer produces a sequence s1, . . . , sn of cards, face up, where each card si has value vi. Then...
Questions
question
Spanish, 28.10.2020 18:00
question
Mathematics, 28.10.2020 18:00
question
English, 28.10.2020 18:00
question
Mathematics, 28.10.2020 18:00
question
Mathematics, 28.10.2020 18:00
question
Business, 28.10.2020 18:00
question
Mathematics, 28.10.2020 18:00
Questions on the website: 13722363