Lecture 01 Intro
Lecture 01 Intro
Srinivas Akella
Department of Computer Science
University of North Carolina, Charlotte
algorithm
• GCD (a, b)
if b==0
return a
else return GCD (b, a mod b)
Some Well-known Computational
Problems
• Sorting* • Traveling salesman
• Searching* problem*
• Shortest paths in a • Knapsack problem*
graph* • Chess
• Minimum spanning tree* • Towers of Hanoi
• Primality testing • Program termination
8
Two main issues related to
algorithms
• How to design algorithms
9
Design of Algorithms
• Many design strategies
– We will cover the most popular strategies
used in CS.
10
Analysis of Algorithms
• How good is the algorithm?
– Correctness
– Time efficiency
– Space efficiency
• F_0 = 0
• F_1 = 1
• F_n = F_(n-1) + F_(n-2), for n >= 2
• Practical importance
16
Course Information
• Syllabus can be found on course web page
and Moodle
• We will cover the highlights now
Course Philosophy
• This course will introduce topics that are at
the core of computer science
– Help you think and talk like a Computer Scientist
• Auxiliary Goals
– critical thinking
– problem solving
– creativity
18
Attendance Policy
• Attendance is not mandatory, but strongly
recommended.
• The required
textbook is:
Introduction to
Algorithms, 3rd
edition, Thomas H.
Cormen, Charles E.
Leiserson, Ronald L.
Rivest, Clifford Stein,
MIT Press, 2009.
20
Homework & Exams
• Homeworks (4)
– Written answers to material covered in class
• Programming Projects (2)
– Use one of C++, Java, Python
– Must be able to read/write files
– Must write commented and documented code
• Exams (2)
Academic Integrity Policy
• All submitted solutions to homeworks and
programming projects must be your own
work.
• See syllabus for policy on discussion of
homeworks and projects
• Report any assistance you receive.
• Violations of any of the academic
integrity rules will be dealt with
harshly!
22
Ok, let’s get started…
• You own a large space telescope
• Lots of astronomers want to use it
• Each astronomer’s project pi requires use of
the telescope starting at a fixed time si (when
their grant starts) and running for li days.
• Only one project can use a telescope at a
time.
• Your goal: Justify yourself to NASA by
scheduling as many projects as possible
Formally…
• Given a set P of projects pi, each occupying
the half-open interval [si, si + li) …
• Choose a subset ¦ µ P of project for which
– No two projects intervals overlap
– The number of projects in ¦ is maximized