--- class: middle,center .fit[![meme](figures/meme/from-students/Man-of-Culture-from-Hao-Yi.jpg)] .tiny[by Hao Yi (21/22)] --- class: bottom,right background-image: url(figures/meme/from-students/making-meme.jpg) .tiny[by Benjamin Poh (21/22)] --- class: center,middle ![meme](figures/meme/from-students/memes-appear-from-Benjamin-Poh.png) .tiny[by Benjamin Poh (21/22)] --- ### Taxi .tiny[ ```C double surcharge(long day, long hour, long minute) { if (is_weekday(day) && is_morning_peak(hour, minute)) { return MORNING_SURCHARGE; } if (is_evening_peak(hour)) { return EVENING_SURCHARGE; } if (is_midnight_peak(hour)) { return MIDNIGHT_SURCHARGE; } return 1.0; } ``` ] --- .tiny[ ```C bool is_weekday(long day) { return (day >= 1 && day <= 5); } bool is_morning_peak(long hour, long minute) { return (hour >= 6 && hour < 9) || (hour == 9 && minute <= 29); } bool is_evening_peak(long hour) { return (hour >= 18 && hour <= 23); } bool is_midnight_peak(long hour) { return (hour >= 0 && hour < 6); } ``` ] --- ### Social .tiny[ ```C // is i and j connected through some m at h+1 hops? char is_connected(long n, char **degree_1, char **degree_h, long i, long j) { for (long m = 0; m < n; m += 1) { if (is_friend(degree_1, i, m) && is_friend(degree_h, m, j)) { return FRIEND; } } return STRANGER; } ``` ] --- ### Social .tiny[ ```C bool is_friend(char **network, int i, int j) { if (i >= j) { return network[i][j] == FRIEND; } return network[j][i] == FRIEND; } ``` ] --- class: center,middle ![meme](figures/meme/goodbye-cs1010.jpg)