This activity is an opportunity to assess the space and time complexity of pre-written code.
- The requirements.txt for this activity is empty, so it's not strictly required to set up a virtual environment, but feel free to do so.
- Identify where the code starts running.
- Identify the code that has been commented out.
- Make sure you can run each scenario by adjusting the commented code.
- Make sure that for each scenario, you are able to run each sample input by adjusting the commented code.
- This is the sidewinder problem from the While Loops Problem Set. Please answer the following three questions in your group:
- What does this function do?
- What is the 0() of the time complexity? Why?
- What is the 0() of the space complexity? Why?
- Answer the following questions about
sum_digits
in your group:- What does this function do?
- What is the 0() of the time complexity? Why?
- What is the 0() of the space complexity? Why?
- Try adding similar counting code to that shown in sidewinder
- Answer the following questions about
most_common_entry
in your group:- What does this function do?
- What is the 0() of the time complexity? Why?
- What is the 0() of the space complexity? Why?
When you have finished discussion all three functions, we will return to the main room to discuss an alternate solution to most_common_entry
. Once completed, we will discuss the space and time complexity as a class.