Presentation is loading. Please wait.

Presentation is loading. Please wait.

CSE 20 DISCRETE MATH Prof. Shachar Lovett iClicker frequency: CA.

Similar presentations


Presentation on theme: "CSE 20 DISCRETE MATH Prof. Shachar Lovett iClicker frequency: CA."— Presentation transcript:

1 CSE 20 DISCRETE MATH Prof. Shachar Lovett iClicker frequency: CA

2 Learning goals Mathematics lies at the core of all computer science It it used to develop fast algorithms that solve complex problems This course is the first step

3 Learning goals

4 Logistics

5 About this class: grading Final: 40% March 16 th Midterms (best out of two): 30% Midterm 1: February 2 nd Midterm 2: March 2 nd Homework: 20% Online quizzes: 5% Class participation (Clicker): 5%

6 About this class: attendance This class is interactive – you read the material at home, we discuss it in class. You need an iClicker. Register it on TED. Discussion sections: highly recommended. That is the place to understand the material in a slower pace, see more examples, ask more questions. Office hours: highly recommended. This is your one-on- one time to ask questions and make sure you understand everything.

7 About this class: HW Homeworks are in groups of 3-4 students Submitted online via TED, by Monday 2pm (before class) Collaboration is allowed only within groups, no other collaboration / discussion is allowed Need help? Come to discussion sections and office hours

8 About this class: online quizzes Basic questions about definitions from required reading Should take no more than 10 mins Due before each W/F class Online on TED

9 About this class: Academic integrity You are working on a homework question with your group members and are stuck on a question. You run into a friend who solved the problem already and shows you her solution. You look at it, but put it away before continuing the group conversation. Is this cheating? A. Yes B. No

10 About this class: Academic integrity You form a group to work on a homework assignment. There are three group members and three questions. You split up the work so that each student gets one question. After you work on your individual questions for a while, you get together as a group and proofread the solutions, then hand them in. Is this cheating? A. Yes B. No

11 About this class: Academic integrity You’re working on a homework question and run across a definition you don’t understand. You Google the term and, ‘lo and behold, the first hit is a full solution to the homework question. You avoid reading the solution and close the browser. You keep working on the solution and hand in the assignment, without mentioning the Google search since you didn’t use the result. Is this cheating? A. Yes B. No

12 About this class: Algorithms! Multiply 17 x 142.

13 What did we do?

14 Is there another way? The RPM Algorithm Write the factors in two columns. Repeatedly double the LEFT and halve the right. (Truncate fractions, i.e. toss remainders) Cross out the LEFT values where the RIGHT values are even. Add the remaining LEFT values together.

15 A needle in a haystack You’re working in lab and realize your phone is no longer in your pocket. You turned off the ringer as you came into the room so you know you had it with you. How do you find it?

16 Cutting a cake For N=6 how many pieces? How about for N=600?

17 Two algorithms Alg1(real a, pos int n) x  1.0 for i between 1 and n : x  x * a return x Alg2(real a, pos int n) x  1.0 i  n while i>0 : if i is odd : x  x * a i  i/2 if i > 0: a  a * a return x Are they correct? Compute the same thing? Which one is better?

18 Two algorithms Alg1(real a, pos int n) x  1.0 for i between 1 and n : x  x * a return x Alg2(real a, pos int n) x  1.0 i  n while i>0 : if i is odd : x  x * a i  i/2 if i > 0: a  a * a return x Are they correct? A.Only Alg1 is correct B.Only Alg2 is correct C.Both correct D.Both incorrect

19 Two algorithms Alg1(real a, pos int n) x  1.0 for i between 1 and n : x  x * a return x Alg2(real a, pos int n) x  1.0 i  n while i>0 : if i is odd : x  x * a i  i/2 if i > 0: a  a * a return x Are they the same algorithm? A.Yes B.No

20 Two algorithms Alg1(real a, pos int n) x  1.0 for i between 1 and n : x  x * a return x Alg2(real a, pos int n) x  1.0 i  n while i>0 : if i is odd : x  x * a i  i/2 if i > 0: a  a * a return x Do they compute the same function? A.Yes B.No

21 Two algorithms Alg1(real a, pos int n) x  1.0 for i between 1 and n : x  x * a return x Alg2(real a, pos int n) x  1.0 i  n while i>0 : if i is odd : x  x * a i  i/2 if i > 0: a  a * a return x Which one is better? A.Alg1 B.Alg2 C.Both the same D.Depends on the inputs

22 What’s an algorithm? A. A step by step process B. Any way of solving complex problems C. Computer code D. Math

23 An algorithm? Definition: a step-by-step process Each basic step is simple Together they can compute very complicated things What properties do we care about? A. It should have the correct format (“compile”) B. It should always terminate C. It should give the correct answer D. All of the above

24 For next class Get the book: Jenkyns, Stephenson and read sections 1.1, 1.2 HW1 is due Monday Jan 12 5pm Ask any questions you have about the course, expectations, requirements either in person or via TED Make note of important dates.


Download ppt "CSE 20 DISCRETE MATH Prof. Shachar Lovett iClicker frequency: CA."

Similar presentations


Ads by Google