Institute of Computer Science
  1. Courses
  2. 2025/26 fall
  3. Algorithmics (MTAT.03.238)
ET
Log in

Algorithmics 2025/26 fall

  • Home
    • Critical thinking
  • Lectures
  • Practice groups
    • G1 Tue 12-14
    • G2 Thu 14-16
    • G3 Fri 14-16 online
  • Assignments&Grading
    • Homework and Schedule
      • Information
      • Submit
      • Grading
    • Essays
    • Projects
    • Exam
  • Help
  • Links

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

  • Institute of Computer Science
  • Faculty of Science and Technology
  • University of Tartu
In case of technical problems or questions write to:

Contact the course organizers with the organizational and course content questions.
The proprietary copyrights of educational materials belong to the University of Tartu. The use of educational materials is permitted for the purposes and under the conditions provided for in the copyright law for the free use of a work. When using educational materials, the user is obligated to give credit to the author of the educational materials.
The use of educational materials for other purposes is allowed only with the prior written consent of the University of Tartu.
Terms of use for the Courses environment