13 February |
Java class
structure and non-linear control. Space, Class & Interface, Errors, Exceptions and Nonlinear Control, Concurrency and Threading |
Coursework 1 handed out Debugging |
20 February |
Concurrency,
threading & GUIs. When Threading Goes Bad, Intro to Networking, How to Network |
Ongoing support for
Coursework 1
|
27 February |
GUIs &
Networking Some Final Protocols, Intro to Graphical User Interfaces, Panels, Components & Layouts Galore |
Coursework 2
handed out
|
6 March |
Search
Applications & Internet
programming. Applets & Java's Sordid History, Searching Applications 1, Searching Applications II |
Ongoing support
for Coursework 2 |
13 March |
Part B | Coursework 2 - 1st increment due, marked in lab. |
20 March |
Part B | Coursework 2 due |
integer key, sorta[] // what we are looking for? & the sorted array (don't have to be ints...)
boolean found // have we found it?
integer botIx, topIx // bottom and top boundaries of the search
integer midIx // middle of current search
integer locIx // for storing the correct location if we find it
botIx = 0, topIx = sorta.length - 1, locIx = -1, found = false; // initialize
while ((found == false) AND (botIx < topIx) do
midIx = botIx + topIx / 2; // returns the floor for ints
if (sorta[midIx] == key) {
found = true;
locIx = midIx; // all done!
}
else if (key < sorta[midIx]) {
topIx = midIx - 1;
}
else { // key > sorta[midIx]
botIx = midIx + 1;
}
} // end of while
return locIx; // will have value -1 if key was never found -- calling routine must handle this case!
0 |
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
30,
45, 60 |
31 |
49 |
20 |
23,
53 |
39 |
10 |
12,
27, 42, 57 |
44 |
0 |
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
57 |
20 |
39[1] |
60 |
23 |
42[4] |
44 |
45 |
27 |
10 |
30 |
12 |
49[11] |
39[12] |
53 |
0 |
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
57 |
20 |
39 |
60 |
23 |
42 |
44 |
45 |
27 |
10 |
30 |
12 |
49 |
39 |
53 |