This notebook is by no means a comprehensive introduction to the Python programming language. It covers the essential language features required to implement, test and validate the Algorithms 202 courseworks. It is strongly advised to complement this tutorial with additional reading such as the [official Python documentation](https://docs.python.org/3/), [Python 101](https://leanpub.com/python_101) or the excellent [Hitchhiker's guide to Python](http://docs.python-guide.org/en/latest/).
%% Cell type:markdown id: tags:
### Getting set up
%% Cell type:markdown id: tags:
To use this notebook, you'll first need to install miniconda. To get set up you can follow the start of the [instructions given here for Windows, OS X, and Linux](http://www.menpo.org/installation/). Only go as far as 'Setting Up A Fresh Environment' then jump back here to install the stuff we need (not menpo).
- Create a Python environment with all the code we need in it
- Activate the environment. On OS X/Linux, simply run:
```
> source activate algo202
```
on Windows:
```
> activate algo202
```
- Finally install the line_profiler tool (you can read more about that at our [blog post](http://www.menpo.org/blog/2014/05/line_profiler_ipython/))
```
(algo202) > pip install line_profiler
```
- Now we are all set up. In the future you only need to reactivate the environment to get to work. To run this notebook, launch a Jupyter notebook server, and browse to this downloaded file
```
(algo202) > jupyter notebook
```
- To navigate through the notebook, have a look at this [cheatsheet](https://www.cheatography.com/weidadeyue/cheat-sheets/jupyter-notebook/)
- Provide an alternative implementation of bubble sort with the optimization tricks explained in the Wikipedia article.
- Modify the `my_sorted` function to allow users to choose between the deterministic and the optimized implementations. By default, `my_sorted` should still be using the determinisitic version.
- Run the experiment above with the optimized bubble sort implementation.
- Compare the deterministic and optimized implementations with a plot.