01 Intro
01 Intro
Data Structures
• “Usually” 2+2
• 2-3 hours of lecture: code and slides
• 1-2 hours in which you should do exercises and get help
• https://github.com/arcuri82/algorithms
• You should have already seen the details of Git in other courses…
• git pull
• update your local copy with the latest changes in the repository
• Java 11 JDK
• use OpenJDK, eg downloaded from https://adoptopenjdk.net/
• Git
• Expect 10 questions/exercises
• Based on slides and all code in the repository
• Only 1 question from the Advanced Topics
★ However this does not apply to “continuation” exams, where there can be any number
• See mock exams in the Git repository
• Note: you can still get questions from any of the code in
the repository
• but usually in those cases it is just to complete the code from a starting
snippet, or find bugs in them
Difficulty
• This is a difficult course, more difficult than what you might
be used to and expect
• likely this is the most difficult course you will have during your degree
• Lists (and all data structures will see in this course) are
Java objects, and not treated specially like arrays
List Object Operations
• size(): return how many elements are contained
• so in this class we only start to see a subset of functionalities for linked lists
Unit Testing
Bugs
• assertTrue(condition)
• throw error if condition is false
• assertNotNull(output)
• throw error if output is null
Mark method
as a test
Test Example
@Test
public void testBase(){
Code
execution int res = ArrayExample.sum(array);
• Eg, 83% in
this case
• Code that is
never
executed by
a test, might
have bugs
Debugging
• VERY IMPORTANT
• Easier to understand
with live demo
Breakpoints
State of variables
Homework
• Do exercises in exercises/ex01