# Slides 2020/21

## Lab A.1

Wednesday 23 Sep 2020

## Lab A.2

Monday 28 Sep 2020

Worksheets

References:

## Lab A.3

Wednesday 30 Set 2020

Worksheets:

References: Andrea Passerini - data structures slides

For Realtime stuff during the lab, see this repl:

https://repl.it/@DavidLeoniWork/sciprog-ds-lab-2020-21

## Lab A.4

Monday 5 Oct 2020

Worksheets (now English links are finally online!)

References:

For realtime stuff during the lab, see this repl:

https://repl.it/@DavidLeoniWork/sciprog-ds-lab-2020-21

I copy here last weekend announcment:

I added here some links to exercises: https://en.softpython.org/references.html

• Beginners: try W3Resources

• Intermediate: exercises from LeetCode and first tutorial from Software Carpentry

• Math-oriented people: try Introduction to Scientific Programming with Python by Joakim Sundnes

## Lab A.5

Wednesday 7 Oct 2020

For realtime stuff during the lab, see this repl:

https://repl.it/@DavidLeoniWork/sciprog-ds-lab-2020-21

## Lab A.6

Monday 12 Oct 2020

Worksheets

• More on functions

• Matrices - list of lists

• Errors and testing Note: SoftPython tutorial only talks about quick testing with assert which is fine for Part A of this course. In Part B we will use more sophisticated testing with unittest

References:

For realtime stuff during the lab, see this repl:

https://repl.it/@DavidLeoniWork/sciprog-ds-lab-2020-21

## Lab A.7

Wednesday 14 Oct 2020

Worksheets

References:

For realtime stuff during the lab, see this repl:

https://repl.it/@DavidLeoniWork/sciprog-ds-lab-2020-21

## Lab A.8

Monday 19 Oct 2020

Worksheets:

NOTE: In Part A we will limit ourselves to graph formats and see some theory in separate binary relations notebook, while in Part B of the course will focus on graph algorithms

For realtime stuff during the lab:

### How to see graphviz on repl.it

Since we’re online, I came up with this solution

NOTE: this is a shaky experiment only to share code during the lab, but you won’t need if you do the worksheets above alone.

1. Go to this NEW repl: https://repl.it/@DavidLeoniWork/softgraphviz

2. Fork the project (DO NOT copy paste files in your projects, you really need to fork !)

1. Run the script - you will have to wait some time until it loads all the packages:

NOTE: this will activate a server, which means from now on the server will be kept running and you shouldn’t need to click on Run again (unless of course something is seriously compromised)

1. Try making changes to example.py and then, instead of hitting the usual Run in repl, click the Reload button. Reload will run the script example.py, which at the end regenerates the output.dot file used in the visualization

NOTE: that after a while of inactivity, the server might stop and repl will need to reload all the packages.

## Lab A.9

Wednesday 21 Oct 2020

EXAM - Save the date:

• Simulation: Monday 2 November, 14:30-16:30 (online)

• Midterm Part A: Friday 6 November, 11.30-13.30 (online) - please login 15 mins before and allocate some time after the end in case we have technical problems

Simulation attendance is recommended!: during the simulation and the exam you will connect online to a linux environment (but you do not need to install linux!), so the simulation is your chance to try the system.

You will receive official communication with details in a short time. For now please read exam guidelines from previous years

WORKSHEETS:

Today we focus on graphs as adjacency lists, networkx

NOTE: In Part A we will limit ourselves to graph formats and see some theory in separate binary relations notebook, while in Part B of the course will focus on graph algorithms

For realtime stuff during the lab:

## Lab A.10

Monday 26 Oct 2020

Worksheets:

Today we focus on numpy and matplotlib

NOTE 1: Visualization worksheet is different from Italian version! Contains also some statistics on networks.

NOTE 2: after the lab I put on softpython a revised version of the The AlgoRythm Opera Challenge. In particular even if you were at the lab, make sure to try this new last part of the challenge, with changed variables: most probably you will discover there is some constant in your code which should be a variable instead.

References:

For realtime stuff during the lab:

## Lab A.11

Wednesday 28 Oct 2020

Worksheets:

• Matrices - Numpy images (new!) - was proposed as a challenge during the lab, now on the website you can find a revised version with solutions. Notice images may look like an application, but actually they are matrices, only much nicer to see!

References:

For realtime stuff during the lab:

## Lab A.12

Wednesday 4 Nov 2020

Worksheets:

Note there won’t be pandas during midterm for part A, at most I will use it only to show some data. For you, it could be useful to quickly gain an understanding of dataset contents.

References:

For realtime stuff during the lab:

## Lab B.1

Monday 9 Nov 2020

• Remember that from now on we only use Visual Studio Code, possibly with the Live Share extension, so get familiar with it by reading installation

• Testing with unittest

• OOP (probably only first part)

## Lab B.2

Wednesday 11 Nov 2020

Worksheets:

• OOP Finished ComplexNumber, try doing Multiset on your own.

• OOP Matrix Challenge: (updated after the lab, please use this version). Try solving this for next week. Tests are not provided, you are invited to collaboratively write at least some in the new ‘REPL Test Playground’. You can access the link on Moodle

## Lab B.3

Monday 16 Nov 2020

Worksheets:

## Lab B.4

Wednesday 18 Nov 2020

Worksheets:

• Complexity: the invisible enemy

• Sorting Challenge - I added Partitocracy challenge (a kind of quicksort)

• Sorting in lab we will see quicksort and mergesort, finish the rest at home

## Lab B.5

Monday 23 November

At home: try to finish whole LinkedList worksheet

## Lab B.6

Wednesday 25 November

At home: try to finish whole LinkedList and stacks worksheets

## Lab B.7

Monday 30 November

• Queues (CircularQueue and ItalianQueue)

• I added some exercises about linked lists and queues on Part B References page on Sciprog

At home: try to finish whole Queues worksheet

## Lab B.8

Wednesday 2 December

At home: try to finish whole Binary trees worksheet

## Lab B.9

Wednesday 9 December

Generic trees, at home: try to finish whole Generic trees worksheet

Also:

• during ‘extra’ lab on Monday we’ve seen tree visit using queues, I wrote something about in bintree page

• Also: I updated references sections with exercises from LeetCode about binary trees, adding also some note you might find helpful

• As a further exercise, you might try doing them also on generic trees.

## Lab B.10

Monday 14 December

NOTE: although past years I didn’t give much exercises on graphs, this year you may get one on BFS, DFS, topsort, connected components …

[ ]: