Day 1 In-Class Assignment: Introductions and Sorting Algorithms#

Goals for today’s in-class assignment#

  • Get comfortable with the course website

  • Pratice how to use a Jupyter notebook

  • Get to know your fellow students

  • Start thinking about algorithm design


The course website and Jupyter notebooks#

The course website for this class can be found at cmse.msu.edu/cmse201.
If you have followed the Software Setup Guide on the course website, then you are well on your way to opening and interacting with Jupyter notebooks. You might have figured this out and are reading this in Jupyter already! If that is the case you can skip this step.

Step 1: Open Jupyter in your web browser. You can do this a few different ways:

  • Anaconda interface: Open the Anaconda Navigator. Then, you can launch Jupyter Notebook (or JupyterLab). Jupyter should open in your web browser.

  • Command line: On a Mac, open the Terminal and type jupyter notebook. In Windows, open the cmd window and type jupyter notebook. Jupyter should open in your web browser.

Step 2: Download this assignment from the course website

Step 3: Select this notebook and open it. You will probably find this in your Downloads folder, unless you put it someplace else. Once you have opened this notebook in Jupyter, you should be able to interact with the cells in this notebook, including running the Python cells below.

Video instructions Here is a link to a video walkthrough of the workflow for this class. This includes downloading the assignment from the course website, editing the Python notebook, and uploading the assignment to D2L. There are also instructions on how to download Anaconda to your computer. Your instructor should have gone through this already, but we provide this here for future reference if you need.

https://mediaspace.msu.edu/media/Justin+Earl+Gambrells+Zoom+Meeting/1_3wrg0xd2


Introductions!#

Take a moment to introduce yourself to the people in your group! (10-15 Minutes)#

Introduce yourself to the other students in your group. During your introductions, make sure to get each other know:

  • Your name and your pronouns

  • Your major

  • Whether you’re new to coding or if you have some previous experience

  • “You wake up tomorrow as an animal. What animal would you least want to wake up as?”

Make sure you listen to each other when doing the introductions as this is your first opportunity to start to get to know your classmates!

✎ Put the information for each of your groups members here. (reminder: double-click on this cell to go into “edit mode” and then hit shift+enter when you’re done)*

Member Name1, Pronouns, Major, Coding Experience, Animal

Member Name2, Pronouns, Major, Coding Experience, Animal





Background information on algorithms#

This video contains information about what an algorithm is and how they can be used. We’ll watch this as a class before today’s in-class activity.

To make notebook cells that have Python code in them do something, hold down the ‘shift’ key and then press the ‘enter’ key. You’ll have to do this to get the YouTube videos to run.

# Imports the functionality that we need to display YouTube videos in a Jupyter Notebook.  
# You need to run this cell before you run ANY of the YouTube videos.

from IPython.display import YouTubeVideo  
# Video on Algorithms and Programs
# Watch it in full-screen mode if it's too small for you.

YouTubeVideo("jT0KZ849fak",width=640,height=360)  

Here is the Mediaspace link if the YouTube link is not working: https://mediaspace.msu.edu/media/1_b20az67d


Today’s activity: Sorting algorithms#

The goal: Design an algorithm that sorts a group of people by their birthday (Jan 1st to Dec 31st). The catch is that it can only ask the people yes-or-no questions.

Details:

  • The “input” to this algorithm is a set of people, in a given (random) order.

  • The “output” of this algorithm is the same set of people, but arranged by birthday.

  • The algorithm can change the order of people in the list and can ask for information, but each person can only respond “yes” or “no”.

Examples:

  • “Were you born in July?”

  • “Were you born on February 2nd?”

1) As a group, design a sorting algorithm (20-25 minutes)#

Use a real whiteboard or virtual whiteboard app like Office Whitebaord to plan out your algorithm by sharing a link with your group.

Write your algorithm in words in the box below:

your text here

2) After you’ve designed your algorithm, test it on your own group. (10-15 Minutes)#

How many steps did it take?

your answer here

🛑 STOP AND ASK YOUR INSTRUCTOR TO COME OVER#

3) (Time Permitting) Now form larger groups by joining up with 1-2 other groups (15-20 Minutes)#

Each of the original small groups should take turns implementing their algorithm by sorting the combined members of the other groups.

For each algorithm, keep track of how many steps were required to accurately sort everyone below.

your text here

4) (Time Permitting) Once each team has tested their algorithm take a few minutes to discuss each other’s algorithms and the nature of the process in general#

  • What worked well and what didn’t?

  • Are there ways to make your algorithm work more efficiently?

  • Which algorithm worked the best and why?

  • Did certain aspects of your algorithm work better on the original, smaller groups? Did certain aspects of your algorithm work better on the larger combined groups?

  • What if the individuals that you were trying to sort could ask questions of each other?

Answer these questions in the box below

your answer here


Assignment wrapup#

Please fill out the form that appears when you run the code below. For today’s assignment, ignore the part about pre-class assignment. You must completely fill this out in order to receive credit for the assignment!

from IPython.display import HTML
HTML(
"""
<iframe 
	src="https://cmse.msu.edu/cmse201-ic-survey" 
	width="800px" 
	height="600px" 
	frameborder="0" 
	marginheight="0" 
	marginwidth="0">
	Loading...
</iframe>
"""
)

Submit this assignment by uploading it to the course Desire2Learn web page.#

Go to the “In-class assignments” folder, find the assignment submission link for Day 1, and upload it there.

Congratulations, you’re done!#

Make sure to complete the Pre-class assignment before next class. See you next class!

© Copyright 2025, Department of Computational Mathematics, Science and Engineering at Michigan State University.