Com ompSci ci 201, 201, First D Day Susan Rodger January 10, - - PowerPoint PPT Presentation

com ompsci ci 201 201 first d day
SMART_READER_LITE
LIVE PREVIEW

Com ompSci ci 201, 201, First D Day Susan Rodger January 10, - - PowerPoint PPT Presentation

Com ompSci ci 201, 201, First D Day Susan Rodger January 10, 2019 Website: http://bit.ly/201spring2020 1/10/2020 CompSci 201, Spring 2020 1 Course Information Online Compsc sci/I /Int nter erne net: : http:/ ://bit it.ly/201s


slide-1
SLIDE 1

Com

  • mpSci

ci 201, 201, First D Day

Susan Rodger January 10, 2019

1/10/2020 CompSci 201, Spring 2020 1

Website: http://bit.ly/201spring2020

slide-2
SLIDE 2

Course Information Online

  • Compsc

sci/I /Int nter erne net: : http:/ ://bit it.ly/201s /201spring ing2020 2020 ak aka

https://w ://www2.cs cs.duke.edu .edu/co /courses es/s /spr pring20/co /comps psci201/

  • Sakai

1/10/2020 CompSci 201, Spring 2020 3

slide-3
SLIDE 3

A is for …

  • Algorithm
  • This course is: Data Structures + Algorithms
  • API
  • Using Libraries is the future

1/10/2020 CompSci 201, Spring 2020 5

slide-4
SLIDE 4

PFTD: Plan For the Day

  • Be able to articulate why 201 is the right course

for you, in terms of being able to complete it with understanding

  • What are pre-requisites?
  • Be able to explain what work is expected,

collaboration policies, exams, discussions, assignments, APTs

  • Why are you taking Compsci 201?

1/10/2020 CompSci 201, Spring 2020 6

slide-5
SLIDE 5

PFTD: Part II

  • Be able to read some Java programs and to

analyze them by applying your knowledge of programming to Java programs

  • Analyze for understanding and prediction
  • Know what work you should complete before

January 13, 15, and 16

  • What is due, when is it due

1/10/2020 CompSci 201, Spring 2020 7

slide-6
SLIDE 6

What is Computer Science?

1/10/2020 CompSci 201, Spring 2020 8

“Our species needs, and deserves, a citizenry with minds wide awake and a basic understanding of how the world works.”

  • Carl Sagan
slide-7
SLIDE 7

Algorithms and Data Structures

1/10/2020 CompSci 201, Spring 2020 9

slide-8
SLIDE 8

Course Staff

  • Teachi

aching ng A Associa ciate:

  • Kate O'Hanlon
  • Teachi

aching ng A Assis istant nts: :

  • Yongxin Tan, Carol Yang
  • Head U

d UTAs As:

  • Belanie Nagiel, Megan Phibbons, Charles Lyu,

Daniel Hwang

  • 26

26 UTAs: s see ee co cour urse w web ebsite

1/10/2020 CompSci 201, Spring 2020 10

slide-9
SLIDE 9

What is Computer Science?

  • Grou
  • ups of
  • f 2-4, Do NOT use a search engine
  • http://bit.ly/201spring20-0110-1
  • How is this relevant to Compsci 201?
  • Tradeoffs in scaling Data Structures/Algorithms
  • WOTO

1/10/2020 CompSci 201, Spring 2020 12

slide-10
SLIDE 10

What is Computer Science?

1/10/2020 CompSci 201, Spring 2020 13

3.5 billion snaps/day or 40,000 second 350 million photos to FB/day 100 million Instagram updates/day 5.6 billion Google searches/day

slide-11
SLIDE 11

What is Computer Science?

What is it that distinguishes it from the separate subjects with which it is related? What is the linking thread which gathers these disparate branches into a single discipline? My answer to these questions is simple --- it is the art of programming a computer. It is the art of designing efficient and elegant methods of getting a computer to solve problems, theoretical or practical, small or large, simple or complex.

C.A.R. (Tony)Hoare

1/10/2020 CompSci 201, Spring 2020 14

slide-12
SLIDE 12

What is Computer Science?

  • It is t

the s study of auto tomati ting a algorith thmic p processe sses s that s scale ale

  • Long Division?
  • Updating Search Engine information?
  • Adding up a column of numbers?
  • Sending $$ via Venmo?
  • Updating your LinkedIn page?

1/10/2020 CompSci 201, Spring 2020 16

slide-13
SLIDE 13

Some Goals for 201

  • Given a problem statement & a real data

source, design, develop, debug, and test a Java program that uses appropriate standard libraries to efficiently solve the problem.

  • Write programs that effectively implement and

use data structures such as: arrays, maps, linked lists, stacks, queues, trees, and graphs.

1/10/2020 CompSci 201, Spring 2020 17

slide-14
SLIDE 14

More Goals for 201

  • Evaluate the time and space complexity of

algorithms, especially algorithms that scale, using empirical and mathematical analysis.

  • Apply basic object-oriented design and

programming principles in developing software

1/10/2020 CompSci 201, Spring 2020 18

slide-15
SLIDE 15

Who are you?

1/10/2020 CompSci 201, Spring 2020 19

slide-16
SLIDE 16

Latanya Sweeney

I am a computer scientist with a long history of weaving technology and policy together to remove stakeholder barriers to technology adoption. My focus is on "computational policy" and I term myself a "computer (cross) policy" scientist. I have enjoyed success at creating technology that weaves with policy to resolve real-world technology-privacy clashes. http://latanyasweeney.org/ Identify 87% of US population using (dob,zip,gender). Prof. Government and Technology @ Harvard, instrumental in HIPAA because if de-identification work. Former CTO of the FTC

1/10/2020 CompSci 201, Spring 2020 28

slide-17
SLIDE 17

Code Interlude

  • First 2

201 J Java p a pro rogra gram m – maybe f first e t ever!

  • Use what you know
  • Make informed assumptions
  • When more time? Book, Internet, Friends, Brain
  • All

ll code o

  • nlin

nline: w web ebsite and and G Git itLab

  • Browse, fork, clone, critique, …

1/10/2020 CompSci 201, Spring 2020 29

slide-18
SLIDE 18

What does Code do? WDCD

1/10/2020 CompSci 201, Spring 2020 32

slide-19
SLIDE 19

Understanding Repetition

  • When

hen d does es lo loop ter erminate?

  • What takes

es t time w e when t n this is c code execut ecutes es?

1/10/2020 CompSci 201, Spring 2020 33

slide-20
SLIDE 20

Java Variables and Types

  • Variab

iables les: n name, t , type, va value ue

  • Primitives: int, double
  • wcount, start, end
  • Object: String, Scanner, HashSet
  • s, set, word
  • For r

reach v ach variab iable/ le/objec ect: n name, t , type, , va value ue

  • What are the operations on these?

1/10/2020 CompSci 201, Spring 2020 34

slide-21
SLIDE 21

Understand and Explain

  • "kjv10.

10.txt" w " with 8 h 823,135 ,135 words, 3 , 34,027 u 027 unique ue

  • About one second to run on rodger laptop
  • Double

le, T Triple le, Q , Quadrup uple le o

  • riginal f

inal file

  • Total # words different, # unique same
  • N words in "kjv10", 2N, 3N, 4N respectively
  • Run

untim imes: 1, 1, 1.5 1.5, 2.0, 2.0, 2.5 2.5 --

  • - pat

attern s n simila ilar

  • How to justify empirical with analytical analysis?

1/10/2020 CompSci 201, Spring 2020 35

slide-22
SLIDE 22

From Analysis to Code

  • How to und

understand ( (rea ead) and and c create ( (writ ite)

  • Read book, use Google? read book, ask
  • What book? See syllabus
  • Practice, practice, practice
  • We

e will lo ill look a at a a hig high-le level t el today, m , more d det etails ails i in Dis iscussion M Mond nday and and L Lec ecture Wed edne nesday

  • Pre-discussion work

1/10/2020 CompSci 201, Spring 2020 36

slide-23
SLIDE 23

Java Types and Operations

  • Wha

hat can an we e do wit ith int int and and d doub uble?

  • +,-,/ seen in code, many more
  • Initialize and update
  • Wha

hat c can w an we e do wit ith HashSet?

  • .add(..), .contains(..), .size()
  • What c

can w we do with h Scanner anner?

  • .hasNext(), .next(), .close()

1/10/2020 CompSci 201, Spring 2020 37

slide-24
SLIDE 24

Java Concepts and Conventions

  • Class

sses a s and Objects

  • You invoke methods on … call functions on ..
  • Object dot method: set.add(..) or

s.hasNext() or set.size() or …

  • Variab

iable i le ident ntif ifier iers b begin w in with l lowercase l e let etter er

  • Class i

ident ntif ifie iers b begin w in with u h uppercase l let etter

  • Statements end

end in s in sem emi-colo lon, n, s statem ement ent b blocks crea eated ed b by brace ces: { {..}

1/10/2020 CompSci 201, Spring 2020 38

slide-25
SLIDE 25

WOTO

http:// //bi bit.ly/2 /201spr pring20-01 0110 10-2

1/10/2020 CompSci 201, Spring 2020 39

slide-26
SLIDE 26

Understanding Java and Scale

  • Java is

is an o an object-orient iented ed l lang ngua uage

  • More on classes and objects later
  • Primit

itiv ive t e types: int int, d , double, c char ar, , boolean an, , …

  • Fast, small, values stored in memory
  • Arrays a

are h homogene eneous us collectio ions ns

  • Like Python lists, Matlab array/vector
  • Once created, don’t grow, can hold primitives
  • Arra

rrayList<>, S , Set<>, M Map<> a are c collec lectio ions ns

  • Dynamic, powerful, scale, no primitives

1/10/2020 CompSci 201, Spring 2020 40

slide-27
SLIDE 27

Analyzing Code, Algorithm

  • Wha

hat file o ile of 1,00 1,000,000 00 s strings w will r ill res esult in in this his code e e execut ecuting ing m most q quick ckly ly?

  • Characteristics of file? Bottleneck of method?
  • Wha

hat file o ile of 1,00 1,000,000 00 s strings w will r ill res esult in in this his code e e execut ecuting ing m most s slowly?

1/10/2020 CompSci 201, Spring 2020 41

slide-28
SLIDE 28

Tradeoffs

  • What l

line e is “bottlenec leneck” in this c code/alg lgorit ithm hm?

  • How can we make this faster?
  • Why is Google so fast when searching?
  • Replace

lace HashSet<..> wit ith h ArrayList<..>

  • Why does code still run?
  • Common API, valuable for programmer!!

1/10/2020 CompSci 201, Spring 2020 42

slide-29
SLIDE 29

Course Logistics

  • Please s

e see c e course w websit ite f e for m most m mat ater eria ial/d l/dates es

  • Web:
  • http://bit.ly/201spring2020
  • For gra

r grades

  • Sakai:
  • Exa

Exams:

  • February 14, April 3, April 30 (final)

1/10/2020 CompSci 201, Spring 2020 43

slide-30
SLIDE 30

Course Logistics

  • Please s

e see c e course w websit ite f e for d due d dates es/g /grad ading ing

  • APT Quizzes, Midterm and Final Exams are

assessments

  • Assignments and APTs are where you will

practice and learn the material on your own

  • Discussion – practice and think together
  • Please n

e note collab aboratio ion p n policie cies, A , APT quiz izzes, la late p polic licies, w why hy you u sho houl uld c come t to cla lass

1/10/2020 CompSci 201, Spring 2020 44

slide-31
SLIDE 31

Succeeding in 201

  • Come to

to class ss and parti ticipate: WOTO

  • Only one in the group fills out the WOTO
  • Put in all netids from the group
  • Start w

work ear early, g get help help w when hen need needed

  • Initia

ial l l lat ate p e penalt alties ies a aren' n't h harsh, h, o

  • n-ti

time d doesn't 't matter, b but ut no not d doing ing a assignments is is a a bad ad id idea ea

  • Ask if you have any reason to ask, any reason

1/10/2020 CompSci 201, Spring 2020 45

slide-32
SLIDE 32

Success in 201 is …

1/10/2020 CompSci 201, Spring 2020 46