84

Lecture 12 - NUS Computing - Homeooiwt/cs1010/1819s1/slides/cs1010 … · Morning. Final 30% Midterm 15% PE 2 15% PE 1 10% Assignments 30%. Scope Everything from Unit 1 to Unit 28

  • Upload
    others

  • View
    8

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Lecture 12 - NUS Computing - Homeooiwt/cs1010/1819s1/slides/cs1010 … · Morning. Final 30% Midterm 15% PE 2 15% PE 1 10% Assignments 30%. Scope Everything from Unit 1 to Unit 28
Page 2: Lecture 12 - NUS Computing - Homeooiwt/cs1010/1819s1/slides/cs1010 … · Morning. Final 30% Midterm 15% PE 2 15% PE 1 10% Assignments 30%. Scope Everything from Unit 1 to Unit 28

Lecture 12

Admin MattersRecap and Look Ahead

13 November 2018

Page 3: Lecture 12 - NUS Computing - Homeooiwt/cs1010/1819s1/slides/cs1010 … · Morning. Final 30% Midterm 15% PE 2 15% PE 1 10% Assignments 30%. Scope Everything from Unit 1 to Unit 28

Final Assessment27 November 2018

Morning

Page 4: Lecture 12 - NUS Computing - Homeooiwt/cs1010/1819s1/slides/cs1010 … · Morning. Final 30% Midterm 15% PE 2 15% PE 1 10% Assignments 30%. Scope Everything from Unit 1 to Unit 28

Final30%

Midterm15%

PE 215%

PE 110%

Assignments30%

Page 5: Lecture 12 - NUS Computing - Homeooiwt/cs1010/1819s1/slides/cs1010 … · Morning. Final 30% Midterm 15% PE 2 15% PE 1 10% Assignments 30%. Scope Everything from Unit 1 to Unit 28

ScopeEverything from Unit 1 to Unit 28

Page 6: Lecture 12 - NUS Computing - Homeooiwt/cs1010/1819s1/slides/cs1010 … · Morning. Final 30% Midterm 15% PE 2 15% PE 1 10% Assignments 30%. Scope Everything from Unit 1 to Unit 28

FormatSome MCQs

Some Short Questions

Page 7: Lecture 12 - NUS Computing - Homeooiwt/cs1010/1819s1/slides/cs1010 … · Morning. Final 30% Midterm 15% PE 2 15% PE 1 10% Assignments 30%. Scope Everything from Unit 1 to Unit 28

Open BookNothing to Memorize

Focus on Understanding and Applying Principles

Page 8: Lecture 12 - NUS Computing - Homeooiwt/cs1010/1819s1/slides/cs1010 … · Morning. Final 30% Midterm 15% PE 2 15% PE 1 10% Assignments 30%. Scope Everything from Unit 1 to Unit 28

Assignment 9

Page 9: Lecture 12 - NUS Computing - Homeooiwt/cs1010/1819s1/slides/cs1010 … · Morning. Final 30% Midterm 15% PE 2 15% PE 1 10% Assignments 30%. Scope Everything from Unit 1 to Unit 28

university policy: no deadlines during

reading week

Page 10: Lecture 12 - NUS Computing - Homeooiwt/cs1010/1819s1/slides/cs1010 … · Morning. Final 30% Midterm 15% PE 2 15% PE 1 10% Assignments 30%. Scope Everything from Unit 1 to Unit 28

no change in deadline

Page 11: Lecture 12 - NUS Computing - Homeooiwt/cs1010/1819s1/slides/cs1010 … · Morning. Final 30% Midterm 15% PE 2 15% PE 1 10% Assignments 30%. Scope Everything from Unit 1 to Unit 28

but no late penalty until after 18 November Sunday 23:59

Page 12: Lecture 12 - NUS Computing - Homeooiwt/cs1010/1819s1/slides/cs1010 … · Morning. Final 30% Midterm 15% PE 2 15% PE 1 10% Assignments 30%. Scope Everything from Unit 1 to Unit 28

Deadline to Finalize Marks

5 December 20186:00pm

Page 13: Lecture 12 - NUS Computing - Homeooiwt/cs1010/1819s1/slides/cs1010 … · Morning. Final 30% Midterm 15% PE 2 15% PE 1 10% Assignments 30%. Scope Everything from Unit 1 to Unit 28

Looking Forward

Teaser to CS2040C

Page 14: Lecture 12 - NUS Computing - Homeooiwt/cs1010/1819s1/slides/cs1010 … · Morning. Final 30% Midterm 15% PE 2 15% PE 1 10% Assignments 30%. Scope Everything from Unit 1 to Unit 28

Data Structures

• A collection of data values and the operations that can be applied

• How to organise and manage data for efficient access and modification?

Page 15: Lecture 12 - NUS Computing - Homeooiwt/cs1010/1819s1/slides/cs1010 … · Morning. Final 30% Midterm 15% PE 2 15% PE 1 10% Assignments 30%. Scope Everything from Unit 1 to Unit 28

Example: List• An ordered list of numbers

• Can

• create a list• append to the list• remove a number from the list• find the position of a number• destroy a list• print a list

Page 16: Lecture 12 - NUS Computing - Homeooiwt/cs1010/1819s1/slides/cs1010 … · Morning. Final 30% Midterm 15% PE 2 15% PE 1 10% Assignments 30%. Scope Everything from Unit 1 to Unit 28

3 6array

last

size = 4

Page 17: Lecture 12 - NUS Computing - Homeooiwt/cs1010/1819s1/slides/cs1010 … · Morning. Final 30% Midterm 15% PE 2 15% PE 1 10% Assignments 30%. Scope Everything from Unit 1 to Unit 28

3 6 4array

last

size = 4

append 4

Page 18: Lecture 12 - NUS Computing - Homeooiwt/cs1010/1819s1/slides/cs1010 … · Morning. Final 30% Midterm 15% PE 2 15% PE 1 10% Assignments 30%. Scope Everything from Unit 1 to Unit 28

3 6 4array

last

size = 4

append 2

2

Page 19: Lecture 12 - NUS Computing - Homeooiwt/cs1010/1819s1/slides/cs1010 … · Morning. Final 30% Midterm 15% PE 2 15% PE 1 10% Assignments 30%. Scope Everything from Unit 1 to Unit 28

3 6 4array

last

size = 8

append 2

2

Page 20: Lecture 12 - NUS Computing - Homeooiwt/cs1010/1819s1/slides/cs1010 … · Morning. Final 30% Midterm 15% PE 2 15% PE 1 10% Assignments 30%. Scope Everything from Unit 1 to Unit 28

3 6 4array

last

size = 8

delete 6

2

Page 21: Lecture 12 - NUS Computing - Homeooiwt/cs1010/1819s1/slides/cs1010 … · Morning. Final 30% Midterm 15% PE 2 15% PE 1 10% Assignments 30%. Scope Everything from Unit 1 to Unit 28

3 4 2array

last

size = 8

delete 6

Page 22: Lecture 12 - NUS Computing - Homeooiwt/cs1010/1819s1/slides/cs1010 … · Morning. Final 30% Midterm 15% PE 2 15% PE 1 10% Assignments 30%. Scope Everything from Unit 1 to Unit 28

AY18/19 Sem 1

What will you learn?

Page 23: Lecture 12 - NUS Computing - Homeooiwt/cs1010/1819s1/slides/cs1010 … · Morning. Final 30% Midterm 15% PE 2 15% PE 1 10% Assignments 30%. Scope Everything from Unit 1 to Unit 28

AY18/19 Sem 1

How to write C

Page 24: Lecture 12 - NUS Computing - Homeooiwt/cs1010/1819s1/slides/cs1010 … · Morning. Final 30% Midterm 15% PE 2 15% PE 1 10% Assignments 30%. Scope Everything from Unit 1 to Unit 28

AY18/19 Sem 1

How a C program behaves

Page 25: Lecture 12 - NUS Computing - Homeooiwt/cs1010/1819s1/slides/cs1010 … · Morning. Final 30% Midterm 15% PE 2 15% PE 1 10% Assignments 30%. Scope Everything from Unit 1 to Unit 28

AY18/19 Sem 1

Tools and techniques to help write good and correct C programs

Page 26: Lecture 12 - NUS Computing - Homeooiwt/cs1010/1819s1/slides/cs1010 … · Morning. Final 30% Midterm 15% PE 2 15% PE 1 10% Assignments 30%. Scope Everything from Unit 1 to Unit 28

AY18/19 Sem 1

How to use C to solve computational problems

Page 27: Lecture 12 - NUS Computing - Homeooiwt/cs1010/1819s1/slides/cs1010 … · Morning. Final 30% Midterm 15% PE 2 15% PE 1 10% Assignments 30%. Scope Everything from Unit 1 to Unit 28

AY18/19 Sem 1

Learning to write a program that does what you want it to do is actually not

difficult.

Knowing what you want your program to do is the more challenging part!

Page 28: Lecture 12 - NUS Computing - Homeooiwt/cs1010/1819s1/slides/cs1010 … · Morning. Final 30% Midterm 15% PE 2 15% PE 1 10% Assignments 30%. Scope Everything from Unit 1 to Unit 28

AY18/19 Sem 1

Tools and techniques to help write good and correct C programs

Page 29: Lecture 12 - NUS Computing - Homeooiwt/cs1010/1819s1/slides/cs1010 … · Morning. Final 30% Midterm 15% PE 2 15% PE 1 10% Assignments 30%. Scope Everything from Unit 1 to Unit 28

Tools / Good Practice• clang• vim• bash• lldb*• make*• git*• clang-tidy*

• assertion

• good programming style

• (some) secure programming

• writing documentation

• testing

Page 30: Lecture 12 - NUS Computing - Homeooiwt/cs1010/1819s1/slides/cs1010 … · Morning. Final 30% Midterm 15% PE 2 15% PE 1 10% Assignments 30%. Scope Everything from Unit 1 to Unit 28

AY18/19 Sem 1

How to write C

Page 31: Lecture 12 - NUS Computing - Homeooiwt/cs1010/1819s1/slides/cs1010 … · Morning. Final 30% Midterm 15% PE 2 15% PE 1 10% Assignments 30%. Scope Everything from Unit 1 to Unit 28

C Language / Syntax• Types

• Functions

• + - * / %

• if else

• && || !

• for / while / do-while

• arrays

• pointers & *

• calloc / free

• #include / #define

• struct

• printf / scanf

Page 32: Lecture 12 - NUS Computing - Homeooiwt/cs1010/1819s1/slides/cs1010 … · Morning. Final 30% Midterm 15% PE 2 15% PE 1 10% Assignments 30%. Scope Everything from Unit 1 to Unit 28

Things We Didn’t Cover• FILE I/O

• argc / argv

• enum

• string functions

• bit operations

• separate compilation

Page 33: Lecture 12 - NUS Computing - Homeooiwt/cs1010/1819s1/slides/cs1010 … · Morning. Final 30% Midterm 15% PE 2 15% PE 1 10% Assignments 30%. Scope Everything from Unit 1 to Unit 28

AY18/19 Sem 1

How a C program behaves

Page 34: Lecture 12 - NUS Computing - Homeooiwt/cs1010/1819s1/slides/cs1010 … · Morning. Final 30% Midterm 15% PE 2 15% PE 1 10% Assignments 30%. Scope Everything from Unit 1 to Unit 28

Behavourial / Mental Model

• machine code

• data in memory

• types

• stack and heap

• call stack

• memory address

• call by value / reference

Page 35: Lecture 12 - NUS Computing - Homeooiwt/cs1010/1819s1/slides/cs1010 … · Morning. Final 30% Midterm 15% PE 2 15% PE 1 10% Assignments 30%. Scope Everything from Unit 1 to Unit 28

AY18/19 Sem 1

How to use C to solve computational problems

Page 36: Lecture 12 - NUS Computing - Homeooiwt/cs1010/1819s1/slides/cs1010 … · Morning. Final 30% Midterm 15% PE 2 15% PE 1 10% Assignments 30%. Scope Everything from Unit 1 to Unit 28

Problem Solving• Decomposition

• Recursion & Backtracking

• Flowcharts

• Conditionals

• Loop

• Assertion and Invariants

• Arrays and Lists

• Sorting

• Searching

• Efficiency

Page 37: Lecture 12 - NUS Computing - Homeooiwt/cs1010/1819s1/slides/cs1010 … · Morning. Final 30% Midterm 15% PE 2 15% PE 1 10% Assignments 30%. Scope Everything from Unit 1 to Unit 28

Computational Thinking

The mental process associated with computational problem solving

Page 38: Lecture 12 - NUS Computing - Homeooiwt/cs1010/1819s1/slides/cs1010 … · Morning. Final 30% Midterm 15% PE 2 15% PE 1 10% Assignments 30%. Scope Everything from Unit 1 to Unit 28

1. Decomposition 2. Pattern Recognition 3. Abstraction 4. Algorithms

Page 39: Lecture 12 - NUS Computing - Homeooiwt/cs1010/1819s1/slides/cs1010 … · Morning. Final 30% Midterm 15% PE 2 15% PE 1 10% Assignments 30%. Scope Everything from Unit 1 to Unit 28

Decomposition

Page 40: Lecture 12 - NUS Computing - Homeooiwt/cs1010/1819s1/slides/cs1010 … · Morning. Final 30% Midterm 15% PE 2 15% PE 1 10% Assignments 30%. Scope Everything from Unit 1 to Unit 28

output max

input k and l0..lk-1

max

output min

input k and l0..lk-1

min

output sum

input k and l0..lk-1

sum

max(L, k) min(L, k) sum(L, k)

Page 41: Lecture 12 - NUS Computing - Homeooiwt/cs1010/1819s1/slides/cs1010 … · Morning. Final 30% Midterm 15% PE 2 15% PE 1 10% Assignments 30%. Scope Everything from Unit 1 to Unit 28

Find the Std Dev• Give an algorithm to find the standard

deviation of a given list L of k integers.

sPk�1i=0 (li � µ)2

k

Page 42: Lecture 12 - NUS Computing - Homeooiwt/cs1010/1819s1/slides/cs1010 … · Morning. Final 30% Midterm 15% PE 2 15% PE 1 10% Assignments 30%. Scope Everything from Unit 1 to Unit 28

Break it down to subproblems

Page 43: Lecture 12 - NUS Computing - Homeooiwt/cs1010/1819s1/slides/cs1010 … · Morning. Final 30% Midterm 15% PE 2 15% PE 1 10% Assignments 30%. Scope Everything from Unit 1 to Unit 28

sPk�1i=0 (li � µ)2

k

sqrtmeansquare

subtract

Page 44: Lecture 12 - NUS Computing - Homeooiwt/cs1010/1819s1/slides/cs1010 … · Morning. Final 30% Midterm 15% PE 2 15% PE 1 10% Assignments 30%. Scope Everything from Unit 1 to Unit 28

taxi

Page 45: Lecture 12 - NUS Computing - Homeooiwt/cs1010/1819s1/slides/cs1010 … · Morning. Final 30% Midterm 15% PE 2 15% PE 1 10% Assignments 30%. Scope Everything from Unit 1 to Unit 28

double surcharge(long day, long hour, long minute){ if (is_weekday(day) && is_morning_peak(hour, minute)) { return MORNING_SURCHARGE; } if (is_evening_peak(hour)) { return EVENING_SURCHARGE; } if (is_midnight_peak(hour)) { return MIDNIGHT_SURCHARGE; } return 1.0;}

Page 46: Lecture 12 - NUS Computing - Homeooiwt/cs1010/1819s1/slides/cs1010 … · Morning. Final 30% Midterm 15% PE 2 15% PE 1 10% Assignments 30%. Scope Everything from Unit 1 to Unit 28

bool is_weekday(long day){ return (day >= 1 && day <= 5);}

bool is_morning_peak(long hour, long minute){ return (hour >= 6 && hour < 9) || (hour == 9 && minute <= 29);}

bool is_evening_peak(long hour){ return (hour >= 18 && hour <= 23);}

bool is_midnight_peak(long hour){ return (hour >= 0 && hour < 6);}

Page 47: Lecture 12 - NUS Computing - Homeooiwt/cs1010/1819s1/slides/cs1010 … · Morning. Final 30% Midterm 15% PE 2 15% PE 1 10% Assignments 30%. Scope Everything from Unit 1 to Unit 28

social

Page 48: Lecture 12 - NUS Computing - Homeooiwt/cs1010/1819s1/slides/cs1010 … · Morning. Final 30% Midterm 15% PE 2 15% PE 1 10% Assignments 30%. Scope Everything from Unit 1 to Unit 28

bool is_friend(char **network, int i, int j) { if (i >= j) { return network[i][j] == FRIEND; } return network[j][i] == FRIEND;}

Page 49: Lecture 12 - NUS Computing - Homeooiwt/cs1010/1819s1/slides/cs1010 … · Morning. Final 30% Midterm 15% PE 2 15% PE 1 10% Assignments 30%. Scope Everything from Unit 1 to Unit 28

/** * Checks if i and j has a common friend * @param[in] n The number of users * @param[in] degree_1 The 1-hop friendship information * @param[in] degree_h The h-hop friendship information * @param[in] i A user * @param[in] j Another user * @return FRIEND if i and j has a (h+1)-hop connection, * STRANGER otherwise. */char is_connected(long n, char **degree_1, char **degree_h, long i, long j) { for (int m = 0; m < n; m += 1) { if (is_friend(degree_1, i, m) && is_friend(degree_h, m, j)) { return FRIEND; } } return STRANGER;}

Page 50: Lecture 12 - NUS Computing - Homeooiwt/cs1010/1819s1/slides/cs1010 … · Morning. Final 30% Midterm 15% PE 2 15% PE 1 10% Assignments 30%. Scope Everything from Unit 1 to Unit 28

/** * Computers the h-hop friendship for the whole network. * @param[in] n The number of users. * @param[in] degree_1 The 1-hop friendship network * @param[in] degree_h The h-hop friendship network * @param[out] degree_h1 The (h+1)-hop friendship network */void compute_degree_h(long n, char **degree_1, char **degree_h, char **degree_h1) { for (int i = 0; i < n; i += 1) { for (int j = 0; j <= i; j += 1) { if (is_friend(degree_h, i, j)) { degree_h1[i][j] = FRIEND; } else { degree_h1[i][j] = is_connected(n, degree_1, degree_h, i, j); } } }}

Page 51: Lecture 12 - NUS Computing - Homeooiwt/cs1010/1819s1/slides/cs1010 … · Morning. Final 30% Midterm 15% PE 2 15% PE 1 10% Assignments 30%. Scope Everything from Unit 1 to Unit 28

Decomposition

break complex problems down into “bite-size” subproblems

that you can solve

Page 52: Lecture 12 - NUS Computing - Homeooiwt/cs1010/1819s1/slides/cs1010 … · Morning. Final 30% Midterm 15% PE 2 15% PE 1 10% Assignments 30%. Scope Everything from Unit 1 to Unit 28

George Pólya said

“If you can’t solve a problem, then there is an easier problem

you can solve: find it”

Page 53: Lecture 12 - NUS Computing - Homeooiwt/cs1010/1819s1/slides/cs1010 … · Morning. Final 30% Midterm 15% PE 2 15% PE 1 10% Assignments 30%. Scope Everything from Unit 1 to Unit 28

Solve easier problem, then generalised

Page 54: Lecture 12 - NUS Computing - Homeooiwt/cs1010/1819s1/slides/cs1010 … · Morning. Final 30% Midterm 15% PE 2 15% PE 1 10% Assignments 30%. Scope Everything from Unit 1 to Unit 28

e.g., find two hops

neighbors, then generalise to k hops

Page 55: Lecture 12 - NUS Computing - Homeooiwt/cs1010/1819s1/slides/cs1010 … · Morning. Final 30% Midterm 15% PE 2 15% PE 1 10% Assignments 30%. Scope Everything from Unit 1 to Unit 28

# # # ## ## # # # # #### #### # # # # ###### ###### # # # # # # # # ## ## ## ## ## ## # # # # # # # # ########## ########## # # # # # # # # ############ ############ # # # # # # # # # # # # ## # ## # ## ## # ## # ## # # # # # # # # # # # # # # # # ################ ################ # # # # # # # # # # # # ################## ################## # # # # # # # # # # # # # # # # ## ## # ## # ## ## ## ## # ## # ## ## # # # # # # # # # # # # # # # # # # # # ###################### ###################### # # # # # # # # # # # # # # # # #### #### #### #### #### #### #### #### #### #### # # # # # # # # # # # # # # # # # # # # # # # # ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## # # # # # # # # # # # # # # # # # # # # # # # ############################# ############################

e.g., draw left most cells, then draw the rest.

Page 56: Lecture 12 - NUS Computing - Homeooiwt/cs1010/1819s1/slides/cs1010 … · Morning. Final 30% Midterm 15% PE 2 15% PE 1 10% Assignments 30%. Scope Everything from Unit 1 to Unit 28

Pattern Recognition

Page 57: Lecture 12 - NUS Computing - Homeooiwt/cs1010/1819s1/slides/cs1010 … · Morning. Final 30% Midterm 15% PE 2 15% PE 1 10% Assignments 30%. Scope Everything from Unit 1 to Unit 28

pattern

Page 58: Lecture 12 - NUS Computing - Homeooiwt/cs1010/1819s1/slides/cs1010 … · Morning. Final 30% Midterm 15% PE 2 15% PE 1 10% Assignments 30%. Scope Everything from Unit 1 to Unit 28
Page 59: Lecture 12 - NUS Computing - Homeooiwt/cs1010/1819s1/slides/cs1010 … · Morning. Final 30% Midterm 15% PE 2 15% PE 1 10% Assignments 30%. Scope Everything from Unit 1 to Unit 28

vote

Page 60: Lecture 12 - NUS Computing - Homeooiwt/cs1010/1819s1/slides/cs1010 … · Morning. Final 30% Midterm 15% PE 2 15% PE 1 10% Assignments 30%. Scope Everything from Unit 1 to Unit 28

double percentage_of_nixon(long nixon, long total) { return nixon*100.0/total;}

double percentage_of_mcneal(long mcneal, long total) { return mcneal*100.0/total;}

Page 61: Lecture 12 - NUS Computing - Homeooiwt/cs1010/1819s1/slides/cs1010 … · Morning. Final 30% Midterm 15% PE 2 15% PE 1 10% Assignments 30%. Scope Everything from Unit 1 to Unit 28

double percentage(long nvotes, long total) { return nvotes*100.0/total;}

Page 62: Lecture 12 - NUS Computing - Homeooiwt/cs1010/1819s1/slides/cs1010 … · Morning. Final 30% Midterm 15% PE 2 15% PE 1 10% Assignments 30%. Scope Everything from Unit 1 to Unit 28

taxi

Page 63: Lecture 12 - NUS Computing - Homeooiwt/cs1010/1819s1/slides/cs1010 … · Morning. Final 30% Midterm 15% PE 2 15% PE 1 10% Assignments 30%. Scope Everything from Unit 1 to Unit 28
Page 64: Lecture 12 - NUS Computing - Homeooiwt/cs1010/1819s1/slides/cs1010 … · Morning. Final 30% Midterm 15% PE 2 15% PE 1 10% Assignments 30%. Scope Everything from Unit 1 to Unit 28

unit_distance max_distance fare

Every 1000 m next 1 km $3.40

Every 400 m next 9.2 km $0.22

Every 350 m next ∞ km $0.22

Page 65: Lecture 12 - NUS Computing - Homeooiwt/cs1010/1819s1/slides/cs1010 … · Morning. Final 30% Midterm 15% PE 2 15% PE 1 10% Assignments 30%. Scope Everything from Unit 1 to Unit 28

double fare = 0; for (int i = 0; i < NUM_TIERS; i += 1) { if (distance < 0) { return fare; } long min_dist = min(distance, tiers[i].max_distance); fare += tiers[i].fare * ceil(min_dist*1.0 / tiers[i].unit_distance); distance -= tiers[i].max_distance; }

Page 66: Lecture 12 - NUS Computing - Homeooiwt/cs1010/1819s1/slides/cs1010 … · Morning. Final 30% Midterm 15% PE 2 15% PE 1 10% Assignments 30%. Scope Everything from Unit 1 to Unit 28

inversions

Page 67: Lecture 12 - NUS Computing - Homeooiwt/cs1010/1819s1/slides/cs1010 … · Morning. Final 30% Midterm 15% PE 2 15% PE 1 10% Assignments 30%. Scope Everything from Unit 1 to Unit 28

left right

Page 68: Lecture 12 - NUS Computing - Homeooiwt/cs1010/1819s1/slides/cs1010 … · Morning. Final 30% Midterm 15% PE 2 15% PE 1 10% Assignments 30%. Scope Everything from Unit 1 to Unit 28

Pattern Recognition

observe trends and patterns, then generalise

Page 69: Lecture 12 - NUS Computing - Homeooiwt/cs1010/1819s1/slides/cs1010 … · Morning. Final 30% Midterm 15% PE 2 15% PE 1 10% Assignments 30%. Scope Everything from Unit 1 to Unit 28

Abstraction

Page 70: Lecture 12 - NUS Computing - Homeooiwt/cs1010/1819s1/slides/cs1010 … · Morning. Final 30% Midterm 15% PE 2 15% PE 1 10% Assignments 30%. Scope Everything from Unit 1 to Unit 28
Page 71: Lecture 12 - NUS Computing - Homeooiwt/cs1010/1819s1/slides/cs1010 … · Morning. Final 30% Midterm 15% PE 2 15% PE 1 10% Assignments 30%. Scope Everything from Unit 1 to Unit 28
Page 72: Lecture 12 - NUS Computing - Homeooiwt/cs1010/1819s1/slides/cs1010 … · Morning. Final 30% Midterm 15% PE 2 15% PE 1 10% Assignments 30%. Scope Everything from Unit 1 to Unit 28
Page 73: Lecture 12 - NUS Computing - Homeooiwt/cs1010/1819s1/slides/cs1010 … · Morning. Final 30% Midterm 15% PE 2 15% PE 1 10% Assignments 30%. Scope Everything from Unit 1 to Unit 28
Page 74: Lecture 12 - NUS Computing - Homeooiwt/cs1010/1819s1/slides/cs1010 … · Morning. Final 30% Midterm 15% PE 2 15% PE 1 10% Assignments 30%. Scope Everything from Unit 1 to Unit 28
Page 75: Lecture 12 - NUS Computing - Homeooiwt/cs1010/1819s1/slides/cs1010 … · Morning. Final 30% Midterm 15% PE 2 15% PE 1 10% Assignments 30%. Scope Everything from Unit 1 to Unit 28

5 50011000110000001104001100

Page 76: Lecture 12 - NUS Computing - Homeooiwt/cs1010/1819s1/slides/cs1010 … · Morning. Final 30% Midterm 15% PE 2 15% PE 1 10% Assignments 30%. Scope Everything from Unit 1 to Unit 28

Who draw pictures like this??

Page 77: Lecture 12 - NUS Computing - Homeooiwt/cs1010/1819s1/slides/cs1010 … · Morning. Final 30% Midterm 15% PE 2 15% PE 1 10% Assignments 30%. Scope Everything from Unit 1 to Unit 28

abstract generalize

solve

Page 78: Lecture 12 - NUS Computing - Homeooiwt/cs1010/1819s1/slides/cs1010 … · Morning. Final 30% Midterm 15% PE 2 15% PE 1 10% Assignments 30%. Scope Everything from Unit 1 to Unit 28
Page 79: Lecture 12 - NUS Computing - Homeooiwt/cs1010/1819s1/slides/cs1010 … · Morning. Final 30% Midterm 15% PE 2 15% PE 1 10% Assignments 30%. Scope Everything from Unit 1 to Unit 28

Abstraction

identifying and abstracting relevant information

generalize to other domains

Page 80: Lecture 12 - NUS Computing - Homeooiwt/cs1010/1819s1/slides/cs1010 … · Morning. Final 30% Midterm 15% PE 2 15% PE 1 10% Assignments 30%. Scope Everything from Unit 1 to Unit 28

1. Decomposition 2. Pattern Recognition 3. Abstraction 4. Algorithms

Page 81: Lecture 12 - NUS Computing - Homeooiwt/cs1010/1819s1/slides/cs1010 … · Morning. Final 30% Midterm 15% PE 2 15% PE 1 10% Assignments 30%. Scope Everything from Unit 1 to Unit 28

AY18/19 Sem 1

Some words of advice

Page 82: Lecture 12 - NUS Computing - Homeooiwt/cs1010/1819s1/slides/cs1010 … · Morning. Final 30% Midterm 15% PE 2 15% PE 1 10% Assignments 30%. Scope Everything from Unit 1 to Unit 28

AY18/19 Sem 1

Work hard. Very very hard.

Page 83: Lecture 12 - NUS Computing - Homeooiwt/cs1010/1819s1/slides/cs1010 … · Morning. Final 30% Midterm 15% PE 2 15% PE 1 10% Assignments 30%. Scope Everything from Unit 1 to Unit 28

what doesn’t kill you only makes you

stronger

Page 84: Lecture 12 - NUS Computing - Homeooiwt/cs1010/1819s1/slides/cs1010 … · Morning. Final 30% Midterm 15% PE 2 15% PE 1 10% Assignments 30%. Scope Everything from Unit 1 to Unit 28