Modify algorithm to always select president of company

Assignment Help Data Structure & Algorithms
Reference no: EM1359323

A company is planning a party for its employees. The organizers of the party want it to be a fun party, so they have assigned a fun rating to every employee (for any employee x, x's fun rating is denoted by fun(x)) and are planning to invite employees that will maximize fun. The employees at the company are organized into a strict hierarchy, which is encoded as a tree T rooted at the president root(T) of the company. Each node is an immediate supervisor of its children. However, there is a restriction: An employee and his immediate supervisor (his parent in the tree) cannot both attend, because otherwise there would be no fun at all.

a) Give an algorithm that makes a guest list for the party that maximizes the sum of fun ratings of the guests. Denoting the total number of company employees by n, your function should have O(n) time complexity. Show the pseudocode, argue that your algorithms is correct, and argue that its complexity is indeed O(n). Again, make sure that for any guest, the guest's immediate supervisor does not attend (and at the same time, that the overall fun rating of guests is maximized).

b) How would you modify your algorithm to always select the president of the company (regardless of his fun rating or the consequences on the overall amount of fun we can achieve)? How would the time complexity change? Show the modification of the pseu- docode, argue that your modification solves this part correctly, and explain what the new time complexity is.

Reference no: EM1359323

Questions Cloud

Design updateable database for storing customer and sales : Design an updateable database for storing customer and sales data. Explain how to deal with the problems of missing data.
Estimate the compound annual dividend growth rate : The chairman of Heller Industries told a meeting of financial analysts that he expects company's earnings and dividends to double over the next six years.
Explain to what extent companies should be able to use : Explain to what extent companies should be able to use employee data and dictate participation in wellness programs to control health insurance premiums.
Determine expected return : Suppose you have two hundred shares of Somner Resources preferred stock, which currently sells for $40 per share and pays annual dividends of $3.40 each share.
Modify algorithm to always select president of company : How would you modify your algorithm to always select the president of the company (regardless of his fun rating or the consequences on the overall amount of fun we can achieve)?
Explain what challenges do you think disney might face : Explain What challenges do you think Disney might face in doin business in Russia
Taxation of scholarships : Hope receives an $18,500 scholarship from State University. The university specifies that $8,500 is for tuition, books, supplies, and equipment, while $10,000 is for room and board. In addition, Hope works part-time at the campus library and earns..
Find the amount for dividends payment : Wheeler Company had retained earnings as of 12/31/08 of $12 million. During 2009, Wheeler's net income was $4 million. Retained earnings balance at the end of 2009 was equal to 13 million dollar.
What is the change in entropy for the system : What is the change in entropy for the system. How much force must be applied to climb the hill at the same speed and same air resistance.

Reviews

Write a Review

Data Structure & Algorithms Questions & Answers

  Determining worst-case time complexity

The recent discovery of the following fragment of uncommented procedural C code in the Sunlab has caused a big scandal. What is the worst-case time complexity of foo(a,1,N,k), and for which inputsdoes it occur?

  Steps of asymmetric encryption algorithms to read message

Using only asymmetric encryption algorithms write down any steps taken by Bob which permit him to read the message.

  Design algorithm to solve spectral assembly problem

Design an algorithm to solve the Spectral Assembly problem under the above conditions. Does the problem have a unique solution?

  Factors-principles considering indecency regulation issues

What factors and principles should the federal government take into account when considering indecency regulation issues?

  Advantage of fast running time of insertion sort

Running time of quicksort can be enhanced in practice by taking advantage of fast running time of insertion sort when its input is "nearly" sorted.

  Determine the branching factor

Expalin the search algorithm that results from each of the following special cases. How does it relate to other algorithms we have discussed.

  Determine algorithm for cs curriculum consists of n courses

Determine an algorithm which works directly with this graph representation, and calculates minimum number of semesters necessary to complete the curriculum.

  Online vs. face-to-face classes

Communication A significant distinction between online and face-to-face classes lies in the area of communication.

  Calculate worst-case run-time complexity of algorithm

Calculate the worst-case run-time complexity of your algorithm and prove optimality of the solution it gives. Suppose that the road is a straight line with a western end and an eastern end.

  Threat model to describe risk of attack vector

Construct a simple threat model that describes the risk this represents: attacker(s), attack vector, vulnerability, assets, and likelihood of occurrence, likely impact, and plausible mitigations.

  Determine the mean salary as well as the number of salaries

Determine the mean salary as well as the number of salaries.

  Explaining view of header and footer areas of worksheet

In which view can you see header and footer areas of worksheet?

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