Examples and help on code, technicalities, etc...
Python internals
- Arrays vs lists (https://learnpython.com/blog/python-array-vs-list/ ) - make sure to understand differences. Think in terms of C like arrays first (memory slots physically/logically in consecutive memory, all elements of array the same size). It seems most Python lists are implemented via (expandable) arrays of pointers (to contents of list elements). So these lists are not as efficient in storage as arrays.
Google Colab, getting files
https://www.honchosearch.com/blog/seo/how-to-download-files-from-google-colab/
from google.colab import files ... files.download('example_file.csv')
Examples for measuring time
import time import pandas as pd # for saving results from time import perf_counter results = { "n": [], "method": [], "seed": [], "time": [] } start_time = time.time() ... end_time = time.time() results["n"].append(n) results["method"].append( method ) results["seed"].append(seed) results["time"].append(end_time - start_time) pd.DataFrame.from_dict(results).to_excel("hw1_results.xls")
Also check out the demo notebook, which includes code on plotting, timing, .. Notebook