This algorithmic essay template is for students of introductory programming courses. Throughout the template, there are links to relevant sections of our Writing and Coding Guide. Replace any text in italics by yours and delete this paragraph.
Your essay's title¶
Your (and any co-author's) name, current date
The introduction explains what the essay is about, the problem you are solving, and what you assume the reader to know. See our guidance on choosing a problem, writing the text and structuring the essay. This template follows the second structure in the guide. You don't need to change the following code cells.
import os
if 'COLAB_GPU' in os.environ: # if we are in Google Colab...
!pip install algoesup --no-deps
!pip install allowed ruff
# import functions to test the code and to measure the execution time
from algoesup import test, time_functions_int
For information on what the following commands do, see our guide's section on linting and remove this paragraph.
%load_ext algoesup.magics
# check the code's style
%ruff on
# optional: flag the Python constructs not taught in TM112, our introductory course
%allowed on --config tm112.json
1 Tests¶
This section describes and defines the tests you will use to check your solutions. See the testing section of our guide.
tests = [
# Each line is a list or tuple of the form:
# (description, input1, input2, ..., expected_output),
]
2 Solutions¶
2.1 First solution name¶
Describe your first strategy or approach, then implement and test it.
def solution_one():
# Implement your solution here
pass
test(solution_one, tests)
2.2 Second solution name¶
Describe your second strategy or approach, then implement and test it.
def solution_two():
# Implement your solution here
pass
test(solution_two, tests)
3 Performance¶
This optional section compares the performance of your solutions to see which is fastest.
# The next line assumes your functions have a single integer as input.
time_functions_int([solution_one, solution_two])
Analyse the results.
4 Concluding remarks¶
Summarise your findings and conclude which solution is best.
After completing a draft of your essay, do a final check and then see the feedback guide on how to ask for, give, and handle comments.
5 Acknowledgements¶
Credit those who helped you create the essay. See the crediting feedback section of our guide.