Upload
others
View
11
Download
0
Embed Size (px)
Citation preview
CS3000:Algorithms&DataJonathanUllman
Lecture1:• CourseOverview• WarmupExercise(Induction,Asymptotics,Fun)
Sep7,2018
• Name:JonathanUllman• CallmeJon• NEUsince2015• Office:623ISEC• OfficeHours:Wed10:30-12:00
• Research:• Privacy,Cryptography,MachineLearning,GameTheory• Algorithmsareatthecoreofallofthese!
Me
• JerryLanning• OfficeHours:TBD• Location:TBD
• LisaOakley• OfficeHours:Thu12:00-2:00• Location:TBD
• ChandanShankarappa• OfficeHours:Mon2:30-4:30• Location:TBD
TheTATeamOH 2 30 6 30 on MondaysOH 12 00 4 00 on Thursdays
OH on Wednesdays
• TianXia• OfficeHours:Thu2:00-4:00• Location:TBD
• LydiaZakynthinou• OfficeHours:Mon4:30-6:30• Location:TBD
TheTATeam
• Whatisanalgorithm?
• Essentiallyallcomputerprograms(andmore)arealgorithmsforsomecomputationalproblem.
Algorithms
Anexplicit,precise,unambiguous,mechanically-executablesequenceofelementaryinstructionsforsolvingacomputationalproblem.
-JeffErickson
• WhatisAlgorithms?
• Abstractandformalizecomputationalproblems• Identifybroadlyusefulalgorithmdesignprinciplesforsolvingcomputationalproblems
• Rigorouslyanalyze propertiesofalgorithms• ThisClass:correctness,runningtime,spaceusage
• Beyond:extensibility,robustness,simplicity,…
Algorithms
Thestudyofhowtosolvecomputationalproblems.
pi find websites about algorth
• WhatisCS3000:Algorithms&Data?
• Proofsareaboutunderstandingandcommunication,notaboutformalityorcertainty• Differentemphasisfromcoursesonlogic
• We’lltalkalotaboutprooftechniquesandwhatmakesacorrectandconvincingproof
Algorithms
Thestudyofhowtosolvecomputationalproblems.Howtorigorouslyprove properiesofalgorithms.TI
• Thatsoundshard.WhywouldIwanttodothat?
• BuildIntuition:• How/whydoalgorithmsreallywork?• Howtoattacknewproblems?• Whichdesigntechniquesworkwell?• Howtocomparedifferentsolutions?• Howtoknowifasolutionisthebestpossible?
Algorithms
• Thatsoundshard.WhywouldIwanttodothat?
• ImproveCommunication:• Howtoexplainsolutions?• Howtoconvincesomeonethatasolutioniscorrect?• Howtoconvincesomeonethatasolutionisbest?
Algorithms
• Thatsoundshard.WhywouldIwanttodothat?
• LearnProblemSolving/Ingenuity• “Algorithmsarelittlepiecesofbrilliance…”-OlinShivers
Algorithms
• Thatsoundshard.WhywouldIwanttodothat?
• GetRich:• Manyoftheworld’smostsuccessfulcompanies(notablyGoogle)beganwithalgorithms.
• Understandthenaturalworld:• Brains,cells,networks,etc.oftenviewedasalgorithms.
• Fun:• Yes,seriously,fun.
Algorithms
• Thatsoundshard.WhywouldIwanttodothat?
• Youcanonlygaintheseskillswithpractice!
Algorithms
OHHW
TextbookOther resourcesonline
CourseStructureEnd12/4
FinalTBD
Start9/7
MidtermI10/16
MidtermII11/16
• HW=45%• Exams=55%
• MidtermI=15%• MidtermII=15%• Final=25%
A, 30%
B, 50%
C,20%
TypicalGradeDistributionz P
CourseStructureEnd12/4
Start9/7
DivideandConquer
DynamicProgramming
GreedyGraphs NetworkFlow
Misc
Textbook:AlgorithmDesignbyKleinbergandTardos
Moreresourcesonthecoursewebsite
FinalTBD
MidtermI10/16
MidtermII11/16
• WeeklyHWAssignments(45%ofgrade)• DueTuesdaysby11:59pm• HW1outnow!DueTue9/18• Noextensions,nolatework• LowestHWscorewillbedroppedfromyourgrade
• Amixofmathematicalandalgorithmicquestions
Homework
• HomeworkmustbetypesetinLaTeX!• Manyresourcesavailable• Manygoodeditorsavailable(TexShop,TexStudio)• IwillprovideHWsource
HomeworkPolicies
onMac
• HomeworkwillbesubmittedonGradescope!• Entrycode:94V4YJ• Signuptoday,orevenrightthisminute!
HomeworkPolicies
use gradescope for regrades
• Youareencouragedtoworkwithyourclassmatesonthehomeworkproblems.• Youmaynotusetheinternet• Youmaynotusestudents/peopleoutsideoftheclass
• CollaborationPolicy:• Youmustwriteallsolutionsbyyourself• Youmaynotshareanywrittensolutions• Youmuststateallofyourcollaborators• We reservetherighttoaskyoutoexplainanysolution
HomeworkPolicies
CourseWebsitehttp://www.ccs.neu.edu/home/jullman/cs3000f18/syllabus.htmlhttp://www.ccs.neu.edu/home/jullman/cs3000f18/schedule.html
• WewillusePiazzafordiscussions• Askquestionsandhelpyourclassmates• Pleaseuseprivatemessagessparingly
• Signuptoday,orevenrightthisminute!
DiscussionForum Note to self Fix Piazza
• Iteachtwosections:TF1:35andTF3:25• Thesesectionsarecompletelyinterchangeable• YoumaycollaborateonHWacrossmysections• YoumaygotoOHforanyofmyTAs
• Prof.NealYoungteachesanothersection• Noformalrelationshipwithmysections• Willcoververysimilartopicsandsharesomematerials• YoumaynotcollaboratewithProf.Young’ssection• YoushouldnotgotoOHforProf.Young’sTAs
WhatAbouttheOtherSections?
OneMoreThing:Ineedtocounthowmanystudentsareinthisclass!
• Isthiscorrect?• Howlongdoesthistakewith! students?
SimpleCounting
SimCount:Find first studentFirst student says 1Until we’re out of students:Go to next studentNext student says (what last student said + 1)
74 students43 16 seconds
Yes
1 n 2n
rn
4Th beats 2n if n 4
• Isthiscorrect?Why?
RecursiveCounting
RecCount:Everyone set your number to 1 Everyone stand upUntil only one student is standing:Pair up with a neighbor, wait if you don’t find oneFor each pair:Sum up your numbersSit down if you are the taller person in the pair
Say your number
70 student
1 10.73
1
After after every iteration oftheloop
Loopinvariant the sum of the of everyone
standing is n
• Howlongdoesthistakewith! students?
RecursiveCounting
RecCount:Everyone set your number to 1 Everyone stand upUntil only one student is standing:Pair up with a neighbor, wait if you don’t find oneFor each pair:Sum up your numbersSit down if you are the taller person in the pair
Say your number
1 n time RecCount takes uth n students
1 n 2TTHE7 Th 3
• Recurrence: " 1 = 3," ! = 2 + " ! 2⁄
RunningTime
1 l 3
1 2 2 T l 2 3 5
1 4 2 1 T Z 2t2tT 1 7
1 2n 2T 2 t t 2 t 1 l 2ns 13
m
1 n 2 logan t 3
• Claim: Forevery numberofstudents! = 2)" 2) = 2* + 3
RunningTime
• Claim: Foreverynumberofstudents! = 2)" 2) = 2* + 3
• Induction: “automatically”proveforevery*• InductiveHypothesis: Let+ * bethestatement" 2) = 2* + 3
• BaseCase:+ 1 istrue• InductiveStep: Forevery* ≥ 1,+ * ⟹ + * + 1• Conclusion: statementistrueforevery*
ProofbyInduction 1 n 2tT ET l 3
Hmt IN 1 27 2m 13
Claim f MEIN HIM is true
1127 5
f me IN if 112 2mt3 then 112M 21mA 13
• Claim: Foreverynumberofstudents! = 2)" 2) = 2* + 3
ProofbyInduction
Ht H m T 27 2mi 3
BC 1 2 2 1117 5 o H l is true
S Pick any m assume Hlm
1 2M 2 1 27 Uses the
2 1 2Mt 3 fact thatHln istrue
2 mtl 13
AsktheAudience
WhoWantstobeaMillionaire?
• Claim: Forevery! ∈ ℕ,∑ 21234156 = 22 − 1
• ProofbyInduction:
AsktheAudience
• Simplecounting: " ! = 2! steps• Recursivecounting:" ! = 2 log; ! + 3 steps
• Butforthisclass,simplecountingwasfaster???
RunningTimehe 74 2 74 148 steps
2x logzG4 3 E 17 steps
243 seconds
70second
steps are not well defined
• Simplecounting:" ! = 2! seconds• Recursivecounting:" ! = 30 log; ! + 45 seconds
• Comparealgorithmsbyasymptotics!• Log-timebeatslinear-timeas! → ∞
RunningTime