Top Banner
1 CMSC 198K: Science behind computing Bobby Bhattacharjee Samir Khuller University of Maryland
28

1 CMSC 198K: Science behind computing Bobby Bhattacharjee Samir Khuller University of Maryland.

Dec 20, 2015

Download

Documents

Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: 1 CMSC 198K: Science behind computing Bobby Bhattacharjee Samir Khuller University of Maryland.

1

CMSC 198K: Science behind computing

Bobby BhattacharjeeSamir Khuller

University of Maryland

Page 2: 1 CMSC 198K: Science behind computing Bobby Bhattacharjee Samir Khuller University of Maryland.

2

Basic Information

Syllabus Email: [email protected] (Bobby) Email: [email protected] (Samir) TA – Kristin Stephens,

[email protected] UTA – Hailey Lin,

[email protected]

Page 3: 1 CMSC 198K: Science behind computing Bobby Bhattacharjee Samir Khuller University of Maryland.

3

Course Web Page http://www.cs.umd.edu/class/fall2009/cmsc198

k/

All course materials (lecture notes, handouts, homeworks) shall be available on the class page.

Dates for the exams shall be announced shortly.

Page 4: 1 CMSC 198K: Science behind computing Bobby Bhattacharjee Samir Khuller University of Maryland.

4

Computer Science What is the computer

actually doing? Its running a program

(a set of instructions), but what is the program doing?

Typically, an algorithm is what the program implements.

Page 5: 1 CMSC 198K: Science behind computing Bobby Bhattacharjee Samir Khuller University of Maryland.

5

Science vs Technology We are all familiar with the technology,

the internet, the web, the ability to access information, videos, news, make reservations, email – we use this everyday.

How did this happen? Computer Science is a very young field,

with most of the innovation having happened in just the last 60 years.

Page 6: 1 CMSC 198K: Science behind computing Bobby Bhattacharjee Samir Khuller University of Maryland.

6

Outline of Topics

Elementary Algorithms Basics about computers Basics about programming Concepts/Computational thinking Some elementary mathematics The fun stuff: Internet/Secret message

sharing/Communication/Randomization

Page 7: 1 CMSC 198K: Science behind computing Bobby Bhattacharjee Samir Khuller University of Maryland.

7

A typical conversationPerson: What do you do?Me: I am a computer science professor.Person: I have a problem with my PC, can you fix it?Me: No, I don’t think I can do that.Person: You will not fix my PC?Me: I cannot fix my PC, let alone yours.Person: Then what exactly do you do?Me: I study algorithms.Person: Oh, I know that.Me: Really?Person: Yes! I learnt logarithms in high school.

Page 8: 1 CMSC 198K: Science behind computing Bobby Bhattacharjee Samir Khuller University of Maryland.

8

Algorithms not Logarithms!

AL GO R I T H M

Al-Khowarizmi

Samir
Hardware/Software/Algorithms/Logarithms
Page 9: 1 CMSC 198K: Science behind computing Bobby Bhattacharjee Samir Khuller University of Maryland.

9

Algorithms Introduction Recipe for baking a cake…. 2 sticks butter 2 cups flour 1 cup sugar 4 eggs 1 cup milk 1 tsp baking powder Cocoa powder (1/2 pound)Mix the sugar, baking powder and flour, mix in

beaten eggs, melted butter and bake at 325F for 40 mins.

Page 10: 1 CMSC 198K: Science behind computing Bobby Bhattacharjee Samir Khuller University of Maryland.

11

ALGORITHMS

Set of instructions for solving a problem, to find a solution.

What is a problem? What is an instruction? What is a solution?

Page 11: 1 CMSC 198K: Science behind computing Bobby Bhattacharjee Samir Khuller University of Maryland.

12

Page 12: 1 CMSC 198K: Science behind computing Bobby Bhattacharjee Samir Khuller University of Maryland.

13

Why are algorithms central to computing?

An airport shuttle company needs to schedule pickups delivering everyone to the airport on time. Who goes in which shuttle, and in what order do the pickups occur?

A delivery company has several customers and trucks that can carry objects. How should they schedule deliveries to the customers to minimize their cost?

This leads to interesting algorithmic problems…

Page 13: 1 CMSC 198K: Science behind computing Bobby Bhattacharjee Samir Khuller University of Maryland.

14

There are lots of feasible solutions!

How should we pick amongst these solutions?

Some solutions are cheap, and others may be expensive or undesirable.

The number of potential solutions is so large that even a fast computer cannot evaluate all these solutions.

Algorithms tell us how to find good solutions!

Page 14: 1 CMSC 198K: Science behind computing Bobby Bhattacharjee Samir Khuller University of Maryland.

15

Applications of Algorithms

Google News Web Search applications Find a file on your computer Assigning people to tasks E-harmony Resident Assignment Problems

Page 15: 1 CMSC 198K: Science behind computing Bobby Bhattacharjee Samir Khuller University of Maryland.

16

Re-assigning employees

A

BC

D

D

B

C

A

Page 16: 1 CMSC 198K: Science behind computing Bobby Bhattacharjee Samir Khuller University of Maryland.

17

Assigning Interns to Hospitals

The “resident matching” program is a computer program that assigns residents (interns) to hospitals.

Also used for admission to High Schools in several Asian countries.

Many metrics can be defined, we focus on a specific metric here.

Page 17: 1 CMSC 198K: Science behind computing Bobby Bhattacharjee Samir Khuller University of Maryland.

20

The Marriage Problem

N men, N women Each person provides a ranking of

the members of the opposite sex Can we find a “good marriage”? First studied by Gale and Shapley

(1962)

Page 18: 1 CMSC 198K: Science behind computing Bobby Bhattacharjee Samir Khuller University of Maryland.

21

Men’s preference lists

Brad (B)

George(G)

Vince(V)

Jennifer(J) Laura(L) Angelina(A)1 2 3

Page 19: 1 CMSC 198K: Science behind computing Bobby Bhattacharjee Samir Khuller University of Maryland.

22

Women’s Preference List

Jennifer(J)

Angelina(A)

Laura(L)

1 2 3

Brad(B) George(G) Vince(V)

Page 20: 1 CMSC 198K: Science behind computing Bobby Bhattacharjee Samir Khuller University of Maryland.

23

Stable Marriage Problem

A marriage is unstable if there is a pair of people, not married to each other, such that both prefer each other to their current partners. In other words, they have an incentive to elope….

Can we find a “stable” marriage?

Page 21: 1 CMSC 198K: Science behind computing Bobby Bhattacharjee Samir Khuller University of Maryland.

25

(Brad, Jen)

(Vince, Angelina)

(George, Laura)

Unstable since Jen and Vince both prefer each other to their current partners.

Page 22: 1 CMSC 198K: Science behind computing Bobby Bhattacharjee Samir Khuller University of Maryland.

26

An application: resident matching program

Each resident rank orders the hospitals, and each hospital rank orders the residents.

How do we choose an assignment of residents to hospitals?

We do not want a situation that a resident prefers another hospital, and that hospital preferred this resident to the person assigned to them.

Samir
Situation not identical as each hospital has several positions.
Page 23: 1 CMSC 198K: Science behind computing Bobby Bhattacharjee Samir Khuller University of Maryland.

28

FIRST ROUND:

Brad proposes to Jen

Vince proposes to Laura

George proposes to Jen

Jen rejects George, engaged to Brad

Laura engaged to Vince

Angelina gets no proposals….

(Brad,Jen) and (Vince, Laura)

Page 24: 1 CMSC 198K: Science behind computing Bobby Bhattacharjee Samir Khuller University of Maryland.

29

SECOND ROUND:

George proposes to Laura

Laura breaks engagement with Vince, and gets engaged to George

(Brad,Jen) and (George,Laura)

Page 25: 1 CMSC 198K: Science behind computing Bobby Bhattacharjee Samir Khuller University of Maryland.

30

THIRD ROUND:

Vince proposes to Jen

Page 26: 1 CMSC 198K: Science behind computing Bobby Bhattacharjee Samir Khuller University of Maryland.

31

THIRD ROUND:

Vince proposes to Jen

Jen breaks engagement with Brad, and gets engaged to Vince

(Vince,Jen) and (George,Laura)

Page 27: 1 CMSC 198K: Science behind computing Bobby Bhattacharjee Samir Khuller University of Maryland.

32

FOURTH ROUND:

Brad proposes to Angelina

Angelina accepts and gets engaged to Brad

(Vince,Jen), (George,Laura) and (Brad,Angelina)

Page 28: 1 CMSC 198K: Science behind computing Bobby Bhattacharjee Samir Khuller University of Maryland.

33

The couples