# 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.

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:

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)

In there, do exercises:

## Lab, Mon 26-10-15

Java vs Python:

• Similarities and difference?
• What is the difference between dynamic and static types?
• What are the advantages of dynamic and static types?
• What behavior is enforced by static types?

HelloWorld.java:

helloworld.py:

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 the Scanner documentation and the method nextLine() 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.