Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
51 views

Week 10 Randomised Algorithms, Algorithm and Data Ethics, Course Review

This document discusses randomised algorithms and their analysis. It begins with an overview of how randomness can be used to improve algorithm runtime or compute approximate solutions more efficiently. It then discusses how linear congruential generators are commonly used to generate pseudo-random numbers, though they have a relatively short period length and the numbers may be correlated. The document also provides examples of basic probability concepts and analyses the expected runtime of a simple randomised algorithm to find a key in an unordered array. On average, the algorithm is expected to take 1/p iterations, where p is the probability an element contains the desired key.

Uploaded by

MP
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
51 views

Week 10 Randomised Algorithms, Algorithm and Data Ethics, Course Review

This document discusses randomised algorithms and their analysis. It begins with an overview of how randomness can be used to improve algorithm runtime or compute approximate solutions more efficiently. It then discusses how linear congruential generators are commonly used to generate pseudo-random numbers, though they have a relatively short period length and the numbers may be correlated. The document also provides examples of basic probability concepts and analyses the expected runtime of a simple randomised algorithm to find a key in an unordered array. On average, the algorithm is expected to take 1/p iterations, where p is the probability an element contains the desired key.

Uploaded by

MP
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 21

Week 10: Randomised Algorithms, Algorithm and Data Ethics,

Course Review

1/79
Randomised Algorithms
Algorithms employ randomness to

!"improve worst-case runtime


!"compute correct solutions to hard problems more efficiently but with low probability of failure
!"compute approximate solutions to hard problems

2/79
Randomness
Randomness is also useful

!"in computer games:


#"may want aliens to move in a random pattern
#"the layout of a dungeon may be randomly generated
#"may want to introduce unpredictability
!"in physics/applied maths:
#"carry out simulations to determine behaviour
$"e.g. models of molecules are often assume to move randomly
!"in testing:
#"stress test components by bombarding them with random data
#"random data is often seen as unbiased data
$"gives average performance (e.g. in sorting algorithms)
!"in cryptography

3/79
Sidetrack: Random Numbers
How can a computer pick a number at random?

!"it cannot

Software can only produce pseudo random numbers.

!"a pseudo random number is one that is predictable


#"(although it may appear unpredictable)

⇒ Implementation may deviate from expected theoretical behaviour

... Sidetrack: Random Numbers 4/79

The most widely-used technique is called the Linear Congruential Generator (LCG)

!"it uses a recurrence relation:


#"Xn+1 = (a·Xn + c) mod m, where:
$"m is the "modulus"
$"a, 0 < a < m is the "multiplier"
$"c, 0 ≤ c ≤ m is the "increment"
$"X0 is the "seed"
#"if c=0 it is called a multiplicative congruential generator

LCG is not good for applications that need extremely high-quality random numbers
!"the period length is too short
!"period length … length of sequence at which point it repeats itself
!"a short period means the numbers are correlated

... Sidetrack: Random Numbers 5/79

Trivial example:

!"for simplicity assume c=0


!"so the formula is Xn+1 = a·Xn mod m
!"try a=11=X0, m=31, which generates the sequence:

11, 28, 29, 9, 6, 4, 13, 19, 23, 5, 24, 16, 21, 14, 30, 20, 3, 2, 22, 25,
27, 18, 12, 8, 26, 7, 15, 10, 17, 1, 11, 28, 29, 9, 6, 4, 13, 19, 23, 5,
24, 16, 21, 14, 30, 20, 3, 2, 22, 25, 27, 18, 12, 8, 26, 7, 15, 10, 17, 1,
11, 28, 29, 9, 6, 4, 13, 19, 23, 5, 24, 16, 21, 14, 30, 20, 3, 2, 22, 25, 27,
18, 12, 8, 26, 7, 15, 10, 17, 1, 11, 28, 29, 9, 6, 4, 13, 19, 23, 5, 24, 16,
21, 14, 30, 20, 3, 2, 22, 25, 27, 18, 12, 8, 26, 7, 15, 10, 17, 1, 11, 28,
29, 9, 6, 4, 13, 19, 23, 5, 24, 16, 21, 14, 30, 20, 3, 2, 22, 25, 27, 18,
12, 8, 26, 7, 15, 10, 17, 1, ...

!"all the integers from 1 to 30 are here


!"period length = 30

... Sidetrack: Random Numbers 6/79

Another trivial example:

!"again let c=0


!"try a=12=X0 and m=30
#"that is, Xn+1 = 12·Xn mod 30
#"which generates the sequence:

12, 24, 18, 6, 12, 24, 18, 6, 12, 24, 18, 6, 12, 24, 18, 6, 12, 24, 18, 6,
12, 24, 18, 6, 12, 24, 18, 6, 12, 24, 18, 6, ...

!"notice the period length (= 4) … clearly a terrible sequence

... Sidetrack: Random Numbers 7/79

It is a complex task to pick good numbers. A bit of history:

Lewis, Goodman and Miller (1969) suggested

!"Xn+1 = 75·Xn mod (231-1)


!"note:
#"75 is 16807
#"231-1 is 2147483674
#"X0 = 0 is not a good seed value

Most compilers use LCG-based algorithms that are slightly more involved; see www.mscs.dal.ca/~selinger/random/ for details (including a short C program that
produces the exact same pseudo-random numbers as gcc for any given seed value)

... Sidetrack: Random Numbers 8/79

!"Two functions are required:


srand(unsigned int seed) // sets its argument as the seed

rand() // uses a LCG technique to generate random


// numbers in the range 0 .. RAND_MAX

where the constant RAND_MAX is defined in stdlib.h


(depends on the computer: on the CSE network, RAND_MAX = 2147483647)

!"The period length of this random number generator is very large


approximately 16 · ((231) - 1)

... Sidetrack: Random Numbers 9/79

To convert the return value of rand() to a number between 0 .. RANGE

!"compute the remainder after division by RANGE+1

Using the remainder to compute a random number is not the best way:

!"can generate a 'better' random number by using a more complex division


!"but good enough for most purposes

Some applications require more sophisticated, cryptographically secure pseudo random numbers

Exercise #1: Random Numbers 10/79

Write a program to simulate 125 rounds of Two-up.

!"Assume a $10 bet at each round


!"Compute the overall outcome and average per round

#include <stdlib.h>
#include <stdio.h>

#define RUNS 125


#define BET 10

int main(void) {
srand(1234567); // choose arbitrary seed
int coin1, coin2, n, sum = 0;
for (n = 0; n < RUNS; n++) {
do {
coin1 = rand() % 2;
coin2 = rand() % 2;
} while (coin1 != coin2);
if (coin1==1 && coin2==1)
sum += BET;
else
sum -= BET;
}
printf("Final result: %d\n", sum);
printf("Average outcome: %f\n", (float) sum / RUNS);
return 0;
}

... Sidetrack: Random Numbers 12/79

Seeding
There is one significant problem:

!"every time you run a program with the same seed, you get exactly the same sequence of 'random' numbers (why?)

To vary the output, can give the random seeder a starting point that varies with time

!"an example of such a starting point is the current time, time(NULL)


(NB: this is different from the UNIX command time, used to measure program running time)

#include <time.h>
time(NULL) // returns the time as the number of seconds
// since the Epoch, 1970-01-01 00:00:00 +0000

// time(NULL) on July 31st, 2020, 12:59pm was 1596164340


// time(NULL) about a minute later was 1596164401

Randomised Algorithms

14/79
Analysis of Randomised Algorithms
Math needed for the analysis of randomised algorithms:

Sample space… Ω = {ω1,…,ωn}


Probability… 0 ≤ P(ωi) ≤ 1
Event… E⊆Ω

!"Basic probability theory


#"P(E) = Σω∈E P(ω)
#"P(Ω) = 1
#"P(not E) = P(Ω\E) = 1 – P(E)
#"P(E1 and E2) = P(E1∩E2) = P(E1) · P(E2) if E1,E2 independent
!"Expectation
#"event E has probability p ⇒ average number of trials needed to see E is 1/p

!"Combinatorics
#"number of ways to choose k objects from n objects…

(k)
n n · (n − 1) · … · (n − k + 1)
=
1·2·…·k

Exercise #2: Basic Probability 15/79

Consider Ω = {HH, HT, TH, TT} (each outcome with probability ¼)

1. E1 = first coin lands on heads. What is P(E1)?


2. E2 = second coin lands on tails. What is P(E2)?
3. Are E1,E2 independent?
4. Probability of not (E1 and E2)?
5. On average, how often do you have to toss the pair of coins to obtain HH or TT?

1. ½
2. ½
3. Yes
4. 1 – ½·½ = ¾
5. 2 times
is the infinite sum ⋅ 1 + (1 − ) ⋅ ⋅ 2 + (1 − ) ⋅ ⋅ 3 + (1 − ) ⋅ ⋅ 4 + ...
1 1 1 1 1 2 1 1 3 1
Note that 2 =
½ 2 2 2 2 2 2 2

... Analysis of Randomised Algorithms 17/79

Randomised algorithm to find some element with key k in an unordered array:

findKey(L,k):
| Input array L, key k
| Output some element in L with key k
|
| repeat
| randomly select e∈L
| until key(e)=k
| return e

... Analysis of Randomised Algorithms 18/79

Analysis:
1
!"p … ratio of elements in L with key k (e.g. p = )
3
!"Probability of success: 1 (if p > 0)
1
!"Expected runtime:
p

#"Example: a third of the elements have key k ⇒ expected number of iterations = 3

... Analysis of Randomised Algorithms 19/79

If we cannot guarantee that the array contains any elements with key k …

findKey(L,k,d):
| Input array L, key k, maximum #attempts d
| Output some element in L with key k
|
| repeat
| | if d=0 then
| | return failure
| | end if
| | randomly select e∈L
| | d=d-1
| until key(e)=k
| return e

... Analysis of Randomised Algorithms 20/79

Analysis:

!"p … ratio of elements in L with key k


!"d … maximum number of attempts
!"Probability of success: 1 - (1-p)d

( i=1..d−1 )
i ⋅ (1 − p)i−1 ⋅ p + d ⋅ (1 − p)d−1

!"Expected runtime:

#"O(1) if d is a constant
21/79
Randomised Quicksort
Quicksort applies divide and conquer to sorting: First item: pivot = 0
!"Divide
#"pick a pivot element
#"move all elements smaller than the pivot to its left
#"move all elements greater than the pivot to its right
!"Conquer
#"sort the elements on the left
#"sort the elements on the right

22/79
Non-randomised Quicksort
Divide ...

partition(array,low,high):
| Input array, index range low..high
| Output selects array[low] as pivot element
| moves all smaller elements between low+1..high to its left
| moves all larger elements between low+1..high to its right
| returns new position of pivot element
|
| pivot_item=array[low], left=low+1, right=high
| repeat
| | right = find index of rightmost element <= pivot_item
| | left = find index of leftmost element > pivot_item // left=right if none
| | if left<right then
| | swap array[left] with array[right]
| | end if
| until left≥right do
| if low<right then
| swap array[low] with array[right] // right is final position for pivot
| end if
| return right

... Non-randomised Quicksort 23/79

... and Conquer!

Quicksort(array,low,high):
| Input array, index range low..high
| Output array[low..high] sorted
|
| if high > low then // termination condition low >= high
| | pivot = partition(array,low,high)
| | Quicksort(array,low,pivot-1)
| | Quicksort(array,pivot+1,high)
| end if

... Non-randomised Quicksort 24/79

3 6 5 2 4 1 // swap a[left=1] and a[right=5]

3 1 5 2 4 6 // swap a[left=2] and a[right=3]

3 1 2 5 4 6 // swap pivot and a[right=2]


2 1 | 3 | 5 4 6

1 2 | 3 | 5 4 6

1 2 | 3 | 4 | 5 | 6

25/79
Worst-case Running Time
Worst case for Quicksort occurs when the pivot is the unique minimum or maximum element:

!"One of the intervals low..pivot-1 and pivot+1..high is of size n-1 and the other is of size 0
⇒ running time is proportional to n + n-1 + … + 2 + 1
!"Hence the worst case for non-randomised Quicksort is O(n2)

1 2 3 4 5 6

1 | 2 3 4 5 6

1 | 2 | 3 4 5 6

...

1 | 2 | 3 | 4 | 5 | 6

26/79
Randomised Quicksort

partition(array,low,high):
| Input array, index range low..high
| Output randomly select a pivot element from array[low..high]
| moves all smaller elements between low..high to its left
| moves all larger elements between low..high to its right
| returns new position of pivot element
|
| randomly select pivot_index∈[low..high]
| pivot_item=array[pivot_index], swap array[low] with array[pivot_index]
| left=low+1, right=high
| repeat
| | right = find index of rightmost element <= pivot_item
| | left = find index of leftmost element > pivot_item // left=right if none
| | if left<right then
| | swap array[left] with array[right]
| | end if
| until left≥right do
| if low<right then
| swap array[low] with array[right] // right is final position for pivot
| end if
| return right

... Randomised Quicksort 27/79

Analysis:

!"Consider a recursive call to partition() on an index range of size s


#"Good call:
both low..pivot-1 and pivot+1..high shorter than ¾·s
#"Bad call:
one of low..pivot-1 or pivot+1..high greater than ¾·s
!"Probability that a call is good: 0.5
(because half the possible pivot elements cause a good call)

Example of a bad call:

6 3 7 5 8 2 4 1

4 3 6 5 1 2 | 7 | 8

Example of a good call:

4 3 6 5 1 2 | 7 | 8

1 2 | 3 | 5 6 4 | 7 | 8

... Randomised Quicksort 28/79

n … size of array

From probability theory we know that the expected number of coin tosses required in order to get k heads is 2·k

!"For a recursive call at depth d we expect


#"d/2 ancestors are good calls
⇒ size of input sequence for current call is ≤ (¾)d/2 · n
!"Therefore,
#"the input of a recursive call at depth 2·log4/3n has expected size 1
⇒ the expected recursion depth thus is O(log n)
!"The total amount of work done at all the nodes of the same depth is O(n)

Hence the expected runtime is O(n·log n) Best: O(nlogn)


Worst: O(n^2)

29/79
Minimum Cut Problem
Given:

!"undirected graph G=(V,E)

Cut of a graph …

!"a partition of V into S ∪ T


#"S,T disjoint and both non-empty
!"its weight is the number of edges between S and T:
ω(S,T) = | { {s,t}∈E : s∈S, t∈T } |
Minimum cut problem … find a cut of G with minimal weight

... Minimum Cut Problem 30/79

Example:
T
S

31/79
Contraction
Contracting edge e = {v,w} …

!"remove edge e
!"replace vertices v and w by new node n
!"replace all edges {x,v}, {x,w} by {x,n}

… results in a multigraph (multiple edges between vertices allowed) Example:

... Contraction 32/79

Randomised algorithm for graph contraction = repeated edge contraction until 2 vertices remain

contract(G):
| Input graph G = (V,E) with |V|≥2 vertices
| Output cut of G
|
| while |V|>2 do
| randomly select e∈E
| contract edge e in G
| end while
| return the only cut in G

Exercise #3: Graph Contraction 33/79

Apply the contraction algorithm twice to the following graph, with different random choices:
... Contraction 34/79

Analysis:

V … number of vertices
Theorem. Every graph has 2V-1-1 cuts. At most

(2)
V

cuts can have minimum weight.

!"Probability of contract to result in a minimum cut:

(2)
V
≥ 1/
!"This is much higher than the probability of picking a minimum cut at random, which is

(2)
V
≤ / (2V−1 − 1)
!"Single edge contraction can be implemented in O(V) time on an adjacency-list representation ⇒ total running time: O(V2)

(Best known implementation uses O(E) time)

35/79
Karger's Algorithm
Idea: Repeat random graph contraction several times and take the best cut found

MinCut(G):
| Input graph G with V≥2 vertices
| Output smallest cut found
|
| min_weight=∞, d=0
| repeat
| | cut=contract(G)
| | if weight(cut)<min_weight then
| | min_cut=cut, min_weight=weight(cut)
| | end if
| | d=d+1
| until d > binomial(V,2)·ln V
| return min_cut

... Karger's Algorithm 36/79

Analysis:

V … number of vertices
E … number of edges

1
!"Probability of success: ≥ 1 −
V
(2)
V
#"probability of not finding a minimum cut when the contraction algorithm is repeated d = ⋅ ln V times:
[ ( 2 )]
d
V 1 1
≤ 1 − 1/ ≤ ln V =
e V
!"Total running time: O(E·d) = O(E·V2·log V)
#"assuming edge contraction implemented in O(E)

37/79
Sidetrack: Maxflow and Mincut
Given: flow network G=(V,E) with

!"edge weights w(u,v)


!"source s∈V, sink t∈V

Cut of flow network G …

!"a partition of V into S ∪ T


#"s∈ S, t∈T, S and T disjoint
!"its weight is the sum of the weights of the edges between S and T:
∑∑
ω(S, T) = w(u, v)
u∈S v∈T

Minimum cut problem … find cut of a network with minimal weight

Exercise #4: Cut of Flow Networks 38/79

What is the weight of the cut {Fairfield,Parramatta,Auburn}, {Ryde,Homebush,Rozelle}?

12+14 = 26 Weight = flow from source to sink

Exercise #5: Cut of Flow Networks 40/79

Find a minimal cut in:

ω(S,T) = 4

... Sidetrack: Maxflow and Mincut 42/79

Max-flow Min-cut Theorem.


In a flow network G the following conditions are equivalent:
1. f is a maximum flow in G
2. the residual network G relative to f contains no augmenting path
3. value of flow f = weight of some minimum cut (S,T) of G

43/79
Randomised Algorithms for NP-hard Problems
Many NP-hard problems can be tackled by randomised algorithms that

!"compute nearly optimal solutions


#"with high probability

Examples:

!"travelling salesman
!"constraint satisfaction problems, satisfiability
!"… and many more

Simulation

45/79
Simulation
In some problem scenarios

!"it is difficult to devise an analytical solution


!"so build a software model and run experiments

Examples: weather forecasting, traffic flow, queueing, games

Such systems typically require random number generation

!"distributions: uniform, numerical, normal, exponential

Accuracy of results depends on accuracy of model.

46/79
Example: Area inside a Curve
Scenario:

!"have a closed curve defined by a complex function


!"have a function to compute "X is inside/outside curve?"

... Example: Area inside a Curve 47/79

Simulation approach to determining the area:

!"determine a region completely enclosing curve


!"generate very many random points in this region
!"for each point x, compute inside(x)
!"count number of insides and outsides
!"areaWithinCurve = totalArea * insides/(insides+outsides)

i.e. we approximate the area within the curve by using the ratio of points inside the curve against those outside

This general method of approximating is known as Monte Carlo estimation.

48/79
Summary
!" Analysis of randomised algorithms

!"probability of success
!"expected runtime

!" Randomised Quicksort


!" Karger's algorithm
!" Simulation

!"Suggested reading:
#"Moffat, Ch. 9.3, 9.5

Algorithm and Data Ethics

50/79
Data Breaches
Major incidents …

!"TJ Maxx credit and debit card theft (2005-07)

Hackers gained access to accounts of over 100 million customers


⇒ Customers exposed to credit/debit card fraud

!"Yahoo! data breach (2013-16)

Hackers gained access to all 3 billion user accounts


Details taken included names, DOBs, passwords, answers to security questions
⇒ Customers exposed to identity theft
⇒ Over 20 class-action lawsuits filed against Yahoo!

!"Facebook-Cambridge Analytica data scandal (2018)

Millions of people's Facebook profiles used for political purpose without their consent
⇒ Cambridge Analytica went bust as a consequence

... Data Breaches 51/79

The Guardian, 30/03/15 …


... Data Breaches 52/79

Australia's Privacy Act 1988 …

!"outlines how personal information must be used and managed


!"applies to government agencies, businesses and organisations with annual turnover of >$3 million, private health services, …

Individuals have the right to:

!"have access to their personal information


!"know why and how information is collected and who it will be disclosed to
!"ask to stop unwanted direct marketing

Businesses and organisations must comply with the Australian Privacy Principles:

!"how to collect personal information


!"how (not) to use personal information
!"how to secure personal information

... Data Breaches 53/79

Australia's Privacy Act 1988 Notifiable Data Breaches scheme

In the event of a suspected or known data breach …

!"contain breach where possible


!"assess if personal information is likely to result in serious harm to affected individuals
#"individuals must be notified promptly
#"Australian Information Commissioner must also be notified
!"take action to prevent future breaches

54/79
Data (Mis-)use
In 2012 several newspapers reported that …
!"Target used data analysis to predict whether female customers are likely pregnant
!"Target then sent coupons by mail
!"A Minneapolis man thus found out about the pregnancy of his teenage daughter

Not based on a factual story, but not implausible either

Who "owns" your data?

!"big companies (Google, Facebook, …)?


!"governments?
!"you?

... Data (Mis-)use 55/79

!"Respect privacy
#"Store only the minimum amount of personal information necessary
#"Prevent re-identification of anonymised data
!"Carefully analyse the consequences of data aggregation
!"Access data only when authorised or compelled by the public good
#"Whistleblower Manning's disclosing of classified military data to Wikileaks (2010-11)
#"Paradise papers that disclosed offshore investments (2017)

Source: ACM Code of Ethics and Professional Conduct

56/79
Costly Software Errors
NASA's Mars Climate Orbiter …

!"launched 11/12/1998
!"reached Mars on 23/9/1999
!"came too close to surface and disintegrated

Cause of failure:

!"spec said impulse must be calculated in newton seconds


!"one module calculated impulse in pound-force seconds
!"1 newton ≅ 0.2248 pound-force

... Costly Software Errors 57/79

Toyota vehicle recall (2009-11)


!"Vehicles experienced sudden unintended acceleration
!"89 deaths have been linked to the failure
!"9 million cars recalled worldwide

Causes of failure included …

!"a deficiency in the electronic throttle control system:


stack overflow
⇒ stack grew out of boundary, overwrote other data

... Costly Software Errors 58/79

Sydney Morning Herald, 05/01/10:

EFTPOS terminals inoperable for several days in early 2010

!"customers' cards rejected as expired

Cause of failure:

!"one module interpreted the current year as hexadecimal


#"0x09 = 09
#"0x10 = 16 (≠ 10)

59/79
Sidetrack: Year 2038 Problem
Recall:

#include <time.h>
time(NULL) // returns the time as the number of seconds
// since the Epoch, 1970-01-01 00:00:00 +0000

Year 2038 problem …

!"time(NULL) on 19 January 2038 at 03:14:07 (UTC) will be 2147483647 = 0x7FFFFFFF


!"a second later it will be 0x80000000 = -2,147,483,648
!"⇒ -231 seconds since 01/01/1970 ("Epoch") is 13 December 1901 …
60/79
Programming Ethics
From the ACM/IEEE Software Engineering Code …

!"Software engineers shall ensure that their products meet the highest professional standards possible
#"Strive to fully understand the specifications for software
#"Ensure that specifications have been well documented and satisfy the users' requirements
#"Ensure adequate testing, debugging, and review of software and related documents

!"Approve software only if it


#"is safe
#"meets specifications
#"passes appropriate tests
#"does not diminish quality of life, diminish privacy or harm the environment

... Programming Ethics 61/79

Algorithms can save lives.

Uberlingen airplane collision 1/7/02 at 11:35pm …

!"passenger jet V9 2937 and cargo jet QY 611 on collision course at 36,000 feet
!"ground air traffic controller instructed V9 pilot to descend
!"seconds later, the automatic Traffic Collision Avoidance System (TCAS)
#"instructed V9 2937 to climb
#"instructed QY 611 to descend
!"flight 611's pilot followed TCAS, flight 2937's pilot ignored TCAS
!"all 71 people on board the two planes killed

⇒ Collision would not have occurred had both pilots followed TCAS

Exercise #6: Collision Avoidance Algorithm 62/79

The TCAS …

!"builds 3D map of aircraft in the airspace


!"determines if collision threat occurs
!"automatically negotiates mutual avoidance manoeuvre
!"gives synthesised voice instructions to pilots ("climb, climb")

What algorithm would you use for reaching an agreement (climb vs. descent)?

63/79
Moral Dilemmas
How to program an autonomous car …

!"for a potential crash scenario


!"when you have to choose between two actions that are both harmful

This is a modern version of the Trolley Problem …

!"A runaway trolley is on course to kill five people


!"You stand next to a lever that controls a switch
!"If the trolley is diverted, it will kill one person on the side track
Is it ethical to pull the lever and kill the one in order to save the five?

Exercise #7: Moral Dilemmas 64/79

What would you do?

Variations:

!"Fat man on bridge


!"Transplant

⇒ try it yourself on the Moral Machine

Course Review

66/79
Course Review
Goal:

For you to become competent Computer Scientists able to:

!"choose/develop effective data structures


!"choose/develop algorithms on these data structures
!"analyse performance characteristics of algorithms (time/space complexity)
!"package a set of data structures+algorithms as an abstract data type
!"represent data structures and implement algorithms in C

67/79
Assessment Summary
LAB = mark for programs/quizzes (out of 8+8)
MIDTRM = mark for mid-term test (out of 12)
ASST1 = mark for large assignment (out of 12)
EXAM = mark for final exam (out of 60)

if (EXAM >= 25)


FINAL = LAB + MIDTRM + ASST1 + EXAM

To pass the course, you must achieve:

!"at least 25/60 for EXAM 50/100 for FINAL

... Assessment Summary 68/79

Check your results on WebCMS or using

prompt$ 9024 classrun -sturec

ClassKey: 22T1COMP9024 ClassKey: 22T1COMP9024


... ...
lab: 11.5/16 lab: 11.5/16
midterm: 9/12 midterm: 9/12
assn: 8/12 assn: 8/12
Exam: 43/60 Exam: 23/60

Total: 72/100 Total: 38/100


69/79
Final Exam
Goal: to check whether you have become a competent Computer Scientist

Requires you to demonstrate:

!"understanding of fundamental data structures and algorithms


!"ability to analyse time complexity of algorithms
!"ability to develop algorithms from specifications

Lectures, problem sets and assignments have built you up to this point.

... Final Exam 70/79

2-hour (+15mins reading time) online test on Monday 9th May


1:45pm – 4:05pm

Must start test between 1:45pm and 1:50pm to get the full 135 minutes (= 2hrs+15mins)

!"8 multiple-choice questions, 4 open questions


!"Covers all of the contents of this course
!"Each multiple choice question / short answer question is worth 4 marks (8 × 4 = 32)
Each open question is worth 7 marks (4 × 7 = 28)
!"Multiple-choice questions can have one or more correct options
#"You will get partial marks for partially correct answers

... Final Exam 71/79

Sample prac exam available on Moodle

!"2 multiple-choice questions, 2 open questions


!"maximum time: 45 minutes
!"feedback given immediately
#"marks for multiple-choice questions
#"sample solution for open questions

... Final Exam 72/79

Of course, assessment isn't a "one-way street" …

!"I get to assess you in the final exam


!"you get to assess me in UNSW's MyExperience Evaluation
#"go to https://myexperience.unsw.edu.au/
#"login using zID@ad.unsw.edu.au and your zPass

Response rate (as of Friday week 9): 18.3% 😰


Please fill it out …

#"give me some feedback on how you might like the course to run in the future
#"even if that is "Exactly the same. I liked how it was run."

73/79
Revision Strategy
!"Re-read lecture slides and example programs
!"Read the corresponding chapters in the recommended textbooks
!"Review/solve problem sets
!"Attempt the prac exam on Moodle
!"Invent your own variations of the weekly exercises (problem solving is a skill that improves with practice)

74/79
Supplementary Exam
If you attend an exam

!"you are making a statement that you are "fit and healthy enough"
!"it is your only chance to pass (i.e. no second chances)

Supplementary exam only available to students who

!"do not attend the final exam and


!"apply formally for special consideration
#"with a documented and accepted reason for not attending

If you experience a technical issue:

!"Take screenshots of as many of the following as possible:


error messages, screen not loading, timestamped speed tests, power outage maps
!"If issue was severe, apply for Special Consideration after conclusion of exam. Attach screenshots.

Note: Exam has been designed to account for up to 10mins of non-severe technical issues

75/79
Assessment
Assessment is about determining how well you understand the syllabus of this course.

If you can't demonstrate your understanding, you don't pass.

In particular, we don't pass people just because …

!"please, please, … my parents will be ashamed of me


!"please, please, … I tried really hard in this course
!"please, please, … I'll be excluded if I fail COMP9024
!"please, please, … this is my final course to graduate
!"etc. etc. etc.

Failure is a fact of life. For example, my scientific papers or project proposals get rejected sometimes too.

Summing Up …

77/79
So What Was the Real Point?
The aim was for you to become a better computer scientist

!"more confident in your own ability to design data structures and algorithms
!"with an expanded set of fundamental structures and algorithms to draw on
!"able to analyse and justify your choices
!"ultimately, enjoying the software design and development process

78/79
Finally …
Book 2
The Ancient Masters

Thus spake the Master Programmer:

"After three days without programming, life becomes


meaningless."

... Finally … 79/79

That's All Folks


Good Luck with the Exams

and with your future studies

😀 👍 🎓
Produced: 20 Apr 2022

You might also like