Opetusmateriaali
by Jere
Tofferi is licensed under CC BY-SA 4.0
Session 5
Topics:
- We start coding exercises (for this session)
- You can ask help from teacher for your exercises (course exercises) or course (You can ask me to "break out" room with me, and I can look your code)
- At the end, we talk about exercises and our observation
- Answer for first feedback form!
Before session:
Check out session 4
Session materials
Idea of exercises is that you try to improvise functions to different time complexities and test those. Below is template, where you can write functions and test.
Please write up what results (execution time) you get for different functions with different lengths of an array (e.g. n = 1_000, 1_000_000).
- There is some constant time always involved. Try to find when time starts to grow.
- When time grows, try to double n, and check what happens to execution time
- Try to find limit, how much you can increase n before algorithm is useless (you can think what is useless...)
(Note that you can terminate process with Ctrl + c, if it takes too long to complete.)
(Note also, that you can use literal 1_000_000 instead of 1000000 if you have net7.0 or newer)
After session:
Read more about big O and course material
Do course exercises