cs3100 L1 Intro
cs3100 L1 Intro
2
Who’s Who in Algorithms?
Edsger Dijkstra
Al-Khwarizmi
Alan Turing Ada Lovelace
Ray Pettit
Radia Perlman Gauss
Robbie Hott
4
A Historic Perspective
Euclid Al-Khwarizmi Gauss Ada Lovelace
Stephen Cook Radia Perlman
5
Alan Turing Edsger Dijkstra Don Knuth
What Is an Algorithm?
• In mathematics and computer science, an algorithm is a finite
sequence of well-defined, computer-implementable instructions,
typically to solve a class of problems or to perform a computation.
Algorithms are unambiguous specifications for performing
calculation, data processing, automated reasoning, and other tasks.
[Wikipedia Jan 2020]
• An algorithm is a step by step procedure to solve logical and
mathematical problems. [Simple English Wikipedia Aug 2019]
6
Goals
Create an awesome learning experience
Have fun!
7
Co-Instructors
[email protected]
8
Overview of Platforms
Canvas
• Mostly for linking to other things
Course Webpage
• https://uva-cs.github.io/cs3100-s24
• Contains syllabus, coursework instructions, lecture slides, lecture recordings
Gradescope (linked through Canvas)
• For submitting all assignments, viewing grades, requesting regrades
Discord
• Link will be announced soon!
• For communication, including: announcements, (some) office hours, memes, collaboration,
finding teams, etc.
Piazza (available through Canvas)
• For Q&A about content and assignments
• Instructors, TAs and other students read and answer, so ask here rather than email
instructors
Requirements
Note: CS2100 pre-req taken seriously. Don’t meet it? Need approval or
you will be dropped (after add deadline). L
10
Warning
This can be a very challenging class
• Hard material that combines problem-solving, logic, math and programming
• “Holy grail” of computer science
• Useful in practice
• Job interviews
Lots of opportunities to succeed!
I Quit!
Hopefully not you…
11
“Learning Sources”
16
Quizzes
In-person, in your assigned section’s classroom
• Feb. 29: Quiz 1 (Graphs), Quiz 2 (Divide and Conquer)
• Apr. 11: Quiz 3 (Greedy), Quiz 4 (Dynamic Programming)
• May 2 (7-10 pm): Quiz 5 (Network Flow, Machine Learning), Re-take Questions
19
Programming Assignment (PAs)
Goal: Explore one or more topics from a unit by applying and
implementing it
Grading: Primarily based on passing test-cases on Gradescope
• Include comments: any sources, collaborators
• We may ask you to answer short discussion questions about your solution
Languages accepted: Python (3.10.6), Java (19.0.2)
Collaborate? Not in writing or debugging the code, but…
• Can discuss the problem and the overall strategy with other students
• Must list these people in your submission
• Cannot share code, look at each other’s code! (Read syllabus carefully!)
20
PS0 – LaTeX Warmup
23
Academic Integrity
Collaboration Encouraged!
For PSs: groups of up to 5 per assignment (you + 4)
• List your collaborators (by name and UVA computing ID)
• OK to discuss problem, approach to solution, even details about
solution, but… collaboration is "whiteboard only"
• Write-ups (.tex files) must be created independently
• DO NOT share written notes / pictures / code / etc
• DO NOT share documents (ex: Overleaf)
Be able to explain any solution you submit!
DO NOT seek published solutions online
See syllabus about online code examples
24
Academic Integrity
Collaboration Encouraged!
For PAs: you can talk, strategize, design,… together,
but creating and debugging code must be done alone
• List your collaborators (by name and UVA computing ID)
• DO NOT share pieces of code or programs or files
• DO NOT share debugging of code
Be able to explain any solution you submit!
DO NOT seek published solutions online
See syllabus about online code examples
See syllabus about generative AI
25
Late (and Early) Policy
PAs and PSs can be submitted early for a 2% bonus
• Final submission to Gradescope must be 48 hours before the deadline
• Start early, meet with your groups, come to office hours as needed
Late (and Early) Policy
But, sometimes things happen in life, and we can't meet the deadline
• PAs and PSs may be submitted 48 hours after the deadline
• Requests must be made using our online form (see course website)
• Must include a valid reason
• Must be made before the deadline
• Must acknowledge getting an extension for the assignment
• Must include significant work (uploaded to the form)
• No penalty for late submissions within this window
Generative AI
For each assignment, we’ll say if and how generative AI tools can be used
• When you use a tool, you must properly document and credit the tool
(including the prompt)
• Failure to do this is serious violation of academic integrity!
• Keep in mind tools may produce incorrect results, or may result in
plagiarism or copyright violations
• It is your responsibility—not the tool’s—to assure the quality, integrity,
and accuracy of work you submit
• Having said all this, in CS3100 we will examine how such tools can be
useful in the study and practice of algorithm design and analysis!
28
Feedback
We professors are not course dictators, more like civil servants.
We’re open to any suggestion to help you learn.
Let us know!
• In person
• Piazza
• Course staff email: [email protected]
• Email: [email protected] or [email protected]
• PLEASE: put CS3100 in subject line of all emails
• (No Discord DMs, please)
29
Pre-Course Survey
30
Let’s Get Acquainted
Would you like to know a bit about me? J
31
A motivating problem
45
Need an accurate
approximation 𝜋
Circumference = 2𝜋
𝜋 Approximation Algorithm
𝜋 = 3.14159265359...
1 1
2𝜋 > Perimeter = 6
𝜋 Approximation Algorithm
𝜋 = 3.14159265359... 1 digit correct
Solve for 𝑥 𝑥
2
2
𝑥= 𝑥
1 𝑥
3 2
12
= Perimeter > 2𝜋 > Perimeter = 6
3 3.46 > 𝜋 > 3
𝜋 Approximation Algorithm
𝜋 = 3.14159265359... 3 digits correct
20 20
6+ = Perimeter > 2𝜋 > Perimeter = 6 +
70 3.14285 > 𝜋 > 3.14084 71
How to analyze this approach?
$
1 2 2 4𝑘 ! (1103 + 26390𝑘)
= 1
𝜋 9801 𝑘! % 396%!
!"#
𝜋 = 3.14159265358979323846264338327950288419716939937510582097494459
𝑘=0
𝜋 ≈ 3.1415927 8 digits per iteration!
𝑘=1
𝜋 ≈ 3.1415926535897938
Next Steps
55
Review
Next class we will:
• Review how we analyze algorithms, including
• Asymptotic notation, order classes, worst-case, etc.
• Remind you how all this works by applying/reviewing it with sorting
and searching you did in previous course
• Sequential search, binary search
• Sorting: insertion, quicksort, maybe mergesort
• Review and/or introduce proofs from CS2120
• Proof by induction
• Introduce you to how this can be used for proving algorithm correctness
56