LAB2 Agenda
Room
08:30- 10:30
Data Structures and Algorithms Ex C LAB D002 Lecture room, Ser-D
Quick remainders
- How many of you has passed Introduction to Programming from the first semester?
Important Remainder
- From now on LABs and Assignements will be split
- LABs we use to practice (no mark assigned) – so it is encouraged to come try out to develop algorithms and code – and prepare your self better for exam
- You can also learn how to better code your assignements – that I will evaluate
Comments on the assignements
-
I just skimmed some of the assignements:
- create the seperate file to comments the running test or some a principle of some complex algorithm (don’t put findings on running time in code)
- put also the running times in the the seperate file to support your claim
- please comment the code with inline comments: even if it is obvious …
- int max // max value in the array
- please create test methods for each implemented method separatelly
- (don’t put ALL in main!!!)
- or if you want to put in the main please split them into several methods (for each tested method)
- it is ok if you check consistency of input params - a little bit
- don’t please get too much paranoic :)
-
FUN show that how ArrayList looks using std library :)
Intro for today
- Today we are going to do some Matric&Array Manipulations, so you guys become more familiar with array manipulations
- FUN The video about sorting
- For those of you who are already experience with programming this should be not that difficult
- In any case all together we should try to solve as much as we can – let’s see how much we progress
- I also encourage all of you to ask me anything relating the coding and algorithms – during the lecture or during the office hours – we can sit down and chat I will not evaluate you
Coding for today
Insertion Sort:
for j := 2 to n do // A[1..j-1] sorted key := A[j]; i := j-1; while i > 0 and A[i] > key do A[i+1] := A[i]; i--; A[i+1] := key
Bubble Sort:
for j := 2 to n do // A[1..j-2] sorted and minimum for i := n to j do if A[i-1] > A[i] then swap A[i-1] and A[i]