Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

(\"Around the block party planning\") Consider a row of n houses represented as

ID: 3597419 • Letter: #

Question

("Around the block party planning") Consider a row of n houses represented as an array: A[1….n], where the phrase "next door neighbor" having its natural meaning. Each resident is assigned a "fun factor" F[l ..n], which represents how much fun they bring to a party. Your goal is to maximize the fun of a party that you are arranging, but with the constraint that you cannot select three consecutive neighbors. (So for example, if you invite the A[5] and A[6] family, you cannot invite the A[4] or A[7] families.) Give an efficient algorithm to select the quest list.

Explanation / Answer

Answer:-

We can use python language to create a dictionary.

                 A dictionary is a data type that mechanism on key-value pairs.

Example: - (house1:100, house2: 80 house3: 70)

Now later we have allocated each house in accord to its corresponding fun feature. We have to sort the fun features in downward order.

Skipping one value after taking 2 values (i.e. take value1 and value 2 skip value 3 then take value 4 and value 5 skip value 6 ). This will outcome in exploiting the fun feature as the fun is well-ordered in downward order now just place the house number corresponding to values taken in an array and print it. This is one of the algorithm in which way this question can be done.