## Example 2: Rearranging your Netflix movie queue

In a Netflix movie queue, new movies are added to the end of the list.  Any movie in the list can be moved “to the top.”

Example of an actual  Netflix user queue
credit:http://www.itechpost.com/articles/8246/20130423/netflix-curb-moochers-new-family-plan.htm

Assume the “List Order” field feature as shown in the above figure (which allows one to order the movies) is broken and all you can use to rearrange your movies is the move to “TOP” feature. If your list contains only a few items, you can probably click move-to-top without too much planning and you will get the desired result.

If your list contains 500 movies and you want to rearrange them in a certain order, you need an algorithm. Meaning you need a precise and well-defined way in which to click TOP.

The crucial idea of the algorithm: the movie in position 500 in your new list moves to the top, then move the movie in position 499, etc. The final move to the top is for the movie in position 1 of your new list.

For example, consider 12 movies with movie titles equal to first names (to reduce length). The order in the Netflix queue is

Eve, Max, Tom, Ed, Bob, Joe, Ava, Sam, Sue, Meg, Tim, Liz

We want to receive and watch them in alphabetical order and thus want to generate the sequence

Ava, Bob, Ed, Eve, Joe, Liz, Max, Meg, Sam, Sue, Tim, Tom

The figure below illustrates what the queue looks like after the first few move to the top operations (the movie just moved to the top is in bold/red).

“TOP” as an operation to sort a list of movies alphabetically

Discussion topics

• In a list of 500 movies, how many times does this approach click TOP? What is the minimum and what is the maximum number?
• Are there other scenarios where this type of rearranging problem occurs?
• What is the best interface for a user to arrange/rearrange a large number of objects? How can Netflix’s interface be improved?