DM537/DM550
Lab, Mon 7-12-15
There is no weekly note, so we will just work on project.
Ex, Fri 4-12-15
Quiz: 9.4-8
Then we will discuss:
- Binary trees, the difference between pre-order, in-order and post-order.
- Depth-first vs. breadth-first traversal (stack vs. queue). Example tree.
- Multivariate trees, trees with a list of children
Finally, we can discuss a bit about the project and the relevance of trees, stacks and queues.
Lab, Mon 30-11-15
Exercises:
Lab, Mon 23-11-15
Exercises:
Implement quizzes 10.4, 10.9, 10.11
Ex, Fri 20-11-15
Quiz: 6.1, 5-10, 12
Next, we go through the example of CalcPanel.java from section 6.6.4.
Lab, Mon 16-11-15
There is only on exercise for today: 9.2.
Try to solve it and if you feel like you encounter parts that you do not know how to solve, go back and solve exercises from the previous weeks.
Lab, Mon 09-11-15
Exercises:
- 6.7, 6.8, 6.1 (6.2, 6.2 if you like)
- 7.2, 7.6 (use
Scanner
andPrintStream
instead ofTextIO
)
Quiz: 9.3
Then Exercise 9.3
If you have time left, do Exercise 7.3
Lab, Mon 02-11-15
Exercises: 2.1-2, 2.4-5 (Don’t spend too much time on 2.1. Maybe just print one letter.)
Quiz: 2.5-8,11-12
Exercises: 3.1-4 (In all cases where TextIO
is
used, use the Scanner
class instead)
Now find Think Java: How to Think Like a Computer Scientist.
In there, do exercises:
Lab, Mon 26-10-15
Java vs Python:
- Similarities and difference?
- What is the difference between
dynamic
andstatic
types? - What are the advantages of
dynamic
andstatic
types? - What behavior is enforced by static types?
HelloWorld.java
:
1
2
3
4
5
public class HelloWorld {
public static void main(String[] args) {
System.out.println("Hello World!");
}
}
helloworld.py
:
1
print "Hello World!"
Compile and run Java in the terminal:
Look at the Java 7 API,
specifically Scanner
which is similar to input
and raw_input
from Python.
Modifiy
HelloWorld.java
using the topmost example from theScanner
documentation and the methodnextLine()
to prompt the user for a name and then greet the user by saying “Hello Mette!” if the user entered “Mette”.
Finally, do Exercise 2.3 from Chapter 2 of the book.
Useful links
- Course homepage
- Book: PDF | HTML
- Alternative book: PDF | HTML