--- a/main_templates2/danube.scala Mon Nov 02 13:10:02 2020 +0000
+++ b/main_templates2/danube.scala Wed Nov 04 14:46:03 2020 +0000
@@ -157,18 +157,30 @@
// => Nil (there are three ratings for this movie in ratings.csv but they are not positive)
-// If you want to calculate the recommendations for all movies,
-// then use this code (it will take a few seconds calculation time).
+
+// (7) Calculate the recommendations for all movies according to
+// what the recommendations function in (6) produces (this
+// can take a few seconds). Put all recommendations into a list
+// (of strings) and count how often the strings occur in
+// this list. This produces a list of string-int pairs,
+// where the first component is the movie name and the second
+// is the number of how many times they were recommended.
+// Sort all the pairs according to the number
+// of times they were recommended (most recommended movie name
+// first).
-//val all = for (name <- movie_names.map(_._1)) yield {
-// recommendations(ratings_map, movies_map, name)
-//}
+def most_recommended(recs: Map[String, List[String]],
+ movs: Map[String, String]) : List[(String, Int)] = ???
+
-// helper functions
-//List().take(2)
-//List(1).take(2)
-//List(1,2).take(2)
-//List(1,2,3).take(2)
+// testcase
+//
+//most_recommended(ratings_map, movies_map).take(3)
+// =>
+// List((Matrix,698),
+// (Star Wars: Episode IV - A New Hope (1977),402),
+// (Jerry Maguire (1996),382))
+
}