Describe and analyze an algorithm

Assignment Help Data Structure & Algorithms
Reference no: EM13317609

You and your eight-year-old nephew Elmo decide to play a simple card game. Atthe beginning of the game, the cards are dealt face up in a long row. Each card isworth a different number of points. After all the cards are dealt, you and Elmo taketurns removing either the leftmost or rightmost card from the row, until all the cardsare gone. At each turn, you can decide which of the two cards to take. The winner ofthe game is the player that has collected the most points when the game ends.Having never taken an algorithms class, Elmo follows the obvious greedy strategy-when it's his turn, Elmo always takes the card with the higher point value.Your task is to find a strategy that will beat Elmo whenever possible. (It might seemmean to beat up on a little kid like this, but Elmo absolutely hates it when grown-upslet him win.)(a) Prove that you should not also use the greedy strategy. That is, show that thereis a game that you can win, but only if you do not follow the same greedystrategy as Elmo.(b) Describe and analyze an algorithm to determine, given the initial sequence ofcards, the maximum number of points that you can collect playing against Elmo.(c) Five years later, Elmo has become a much stronger player. Describe andanalyze an algorithm to determine, given the initial sequence of cards, the maximum number of points that you can collect playing against a perfect opponent.

Reference no: EM13317609

Questions Cloud

Find the community outweigh drawbacks : Do the benefits of free and easy access to copyrighted materials by individuals, organisations and/or the community outweigh the drawbacks?
Discuss the conditions that characterize pure competition : Discuss the conditions that characterize pure competition (a price taker market) and explain how and why price takers maximize profits at the quantity for which marginal cost, price, and marginal revenue are equal.
Compute the ufos average acceleration during the turn : A pilot claims to have seen a UFO moving initially at a speed of about 465 m/s in an easterly direction and then, Compute the UFO's average acceleration during the turn
Determine the pressure required to increase the jet velocity : Assume the flow is incompressible, irrotational, quasi-steady and the only body force acting is gravity. Determine the pressure, pb, required to increase the jet velocity by 50% relative to the value realized for atmospheric pressure, pa, in the u..
Describe and analyze an algorithm : Describe and analyze an algorithm to determine, given the initial sequence of cards, the maximum number of points that you can collect playing against a perfect opponent.
Determine the coefficient of statics friction of hawser : Determine the (a) the coefficient of statics friction between the hawser and the bollard. (b) the number of times the hawser should be wrapped around the bollard if a 20000 pound force is to be resisted by the same 80 pound force
What is the speed of each sphere when they are far apart : Three small spheres, each have a charge of 3.60 %u03BCC, are arranged in a line, with sphere 2 in the middle. Adjacent spheres are initially 8.70 cm apart. What is the speed of each sphere when they are far apart
Create the roman.h and implement roman class in roman.cpp : Create the roman.h and implement the Roman class in roman.cpp. Make sure that you put in measures to prevent multiple inclusion of the header file. Test your implementation using task2a.cpp.
Find range of value of p for which equilibrium is maintained : a 300 lb block is supported by a rope that was wrapped 1 1/2 times around a horizontal rod. Knowing that the coefficient of static friction is .15 determine the range of values of P for which equilibrium is maintained

Reviews

Write a Review

Data Structure & Algorithms Questions & Answers

  Explaining diffie-hellman public-key algorithm

Use the Diffie-Hellman public-key algorithm to exchange secret keys.

  Sort array of elements using the quick sort algorithm

"sort an array of 10,000 elements using quick sort algorithm as follows: sort the array using pivot as middle element of the array

  2n-1 comparisons are necessary in the worst case

Prove that 2n-1 comparisons are necessary in the worst case to merge two sorted lists containing n elements each.

  Develop the pseudo code need

Develop the pseudo code needed to find the average of ten 8-bit numbers. Use a loop.

  Compute result for receiver after error detection algorithm

If receiver A receives 101010010011100100011101 and another receiver, B, receives 101011111111100100011101 compute the result for each receiver after error detection algorithm is run?

  Explain solution of towers of hanoi problem

Classical Towers of Hanoi problem starts with a stack of n > = 1disks on one of three pegs. Solving problem needs moving stack from peg A to peg B in such a way which only one disc is moved at time and no disc can be placed on top of a disc smalle..

  Find minimum number of storage required for bfs and dfs

Assume we have problem space where there is uniform branching factor b and there is single goal node at depth m. Determine the minimum number of nodes expanded and storage required for BFS and DFS?

  How output of leaky bucket policer can be fed in second

Illustrate how output of the leaky bucket policer can be fed into second leaky bucket policer so that two leaky buckets in series police average rate, peak rate, and burst size.

  Write algorithm to identify substrings which form numbers

Write the algorithm, by using pseudo code, to do the following task. Given string of numbers, identify all the substrings which form numbers that are divisible by 3.

  Truth teller problem

Assume you were in a nation where each person was either a truth teller or a liar. Determine what single question could you ask a person that would permit you to detect whether that person was a truth teller or a liar?

  Write specifications using uml notation for a function

Write specifications using UML notation for a function that computes the sum of the first five positive integers in an array of  n  arbitrary integers.

  Discussion on data mining techniques

The tax authorities working for many governments are often confronted with challenge of detecting tax evasion and fraud. Suppose you work at income tax department.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd