Originally posted by the.raven:
wtf algorithm design!!!!!
*runs away*
and we have to do a weekly presentation too for the hw...
so last Saturday was the presentation for my group...the worse thing was my group members became lazy again and I even had to write their notes for them because if they dunno how to present it will make me lost points...even then they can still screw up during the presentation...
One of the presentation topic was,"I have n cookies. Each of them has a combination of either chocolate chips, butterscotch chips or a combination of both. Now, I like chocolate chips but I hate butterscotch. So give me an algorithm to maximize my "happiness" while eating the cookies..
For example, a sequence of cookies with a total of 10 chocolate chips and 4 butterscotch chips will make me happier than a sequence of cookies with a total of only 5 chocolate chips.
The twist to this problem is, all these cookies are in a row and I want to pick a sequence of them which will maximize my happiness while eating them, but I dun wan to get accused by my siblings of being greedy and only picking the cookies with all chocolate chips (as in just pick one by one) so the only way I can do this is to pick up a few that lies to each other but will still give me the maximum number of choc chips altogether."
So how would u solve this?
P/S: First solve it in O(n^2) time, then solve it in O(n log n) time, if u dunno wat I am talking abt here nvm, just give me a suggestion as to how u wud solve this problem