Suppose you are writing software for a radio station that manages its playlists.
ID: 3732167 • Letter: S
Question
Suppose you are writing software for a radio station that manages its playlists. The program will generate candidate playlists from a record library automatically and station personnel can then check and modify them. Disc jockeys must also be able to change playlists when they are used because what is actually played is often different from what is planned. The playlists are then used to generate reports for paying royalties. You must decide what sort of data structure to use to store playlists. Make a choice and write a design rationale. Your rationale should explain the factors that went into your decision, the design alternatives you considered, your evaluation of design decisions, and the reasoning for your final choice.
Please Type out .. no paper screenshots
Explanation / Answer
Priority queue or two queues.
Most likely two queues.
With a priority queue (at least a heap) operations take O(log n), where-as it would take O(1) with two queues.
Not that it would make a massive difference, unless you have a super performance critical application and there are enough items to actually make a noticeable difference (and the heap will likely come with enough overhead to make it slower for a small n).
Two queues should also make for a slightly simpler, more understandable implementation, which should be the deciding factor here.
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.