Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Professor Arena is planning to reward his algorithm students for surviving the first exam in CS 3 2 5 0 . One idea he has

Professor Arena is planning to reward his algorithm students for surviving the first exam in CS3250. One idea he has is to distribute snack bags (e.g., Lays Potato Chips, Pretzels, Doritos, Cheetos, etc.) at the lecture following the exam. Unbeknownst to many, Prof. Arena is a bit underpaid and underfunded. Consequently, he must devise a reward system so that he is using his money wisely. After consulting his college-age daughter, Mia, for some advice, he arrives at the following gameplan:
All students who took the exam must receive at least one snack bag, even if they performed poorly.
Every student should receive more snack bags than any student to their immediate left or right if they scored higher than that student. Similarly, if a student scored lower than a student to their immediate left or right, they must receive fewer snack bags than their neighbor, who scored higher.
You are provided as input a paired list of exam scores and student names in an array corresponding to the order in which students are seated (you can imagine this as one big, long row of students). You may further assume that all scores are unique (i.e., no two students received the same score on the exam).

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions