|Coordinates||T/Th, 10-11:20am, LINC 210 [Registrar] [Canvas] [Slack]|
Liang Huang (huanlian@)
|TAs||Sizhen Li (lisiz@), Liang Zhang (zhanglia@), and Renjie Zheng (zhengr@)|
|Office Hours||Instructor: T/Th, 11:30am-12pm (KEC 2069)|
TAs: M: 3-4pm and 5-6pm; W: 4-6pm; F: 4-6pm (KEC Atrium).
Extra office hours available before exams.
|Textbooks||[CLRS] Introduction to Algorithms, 3rd or 2nd edi. (default reference).
[KT] Kleinberg and Tardos, Algorithm Design (DP chapter online, all slides online)
[DPV] Dasgupta, Papadimitriou, and Vazirani (DPV). Algorithms (full text online via berkeley)
[E] Jeff Erickson. Algorithms, Etc. (full text online)
How to Think Like a Computer Scientist: Learning Python (full text online)
|Grading (tentative)||Midterm: 20%, Final: 25%, Quizzes: 8+10=18%;
Weekly homework: 3x11=33%, Class Participation: 4%.
For each HW, any complete submission automatically gets 2%.
The other 1% is based on blackbox testing of the specified coding problem.
Coding must be done in Python 3.
no late submission is accepted.
Class participation: we reward the following:
Grading Curve: A/A-: [90,100]; B+/B/B-: [60,90); C: [50,60); F: [0,50).
|Prerequisites||Students are assumed to be familiar with Data Structures (CS 261) and fluent in at least one mainstream language (C/C++, Java, Python). We'll start with a brief review of Data Structures integrated with a Python tutorial.|
Canvas is for announcements (you'll receive an email for each announcement I made on Canvas)
and checking grades,
and Slack is for discussions.
For technical questions, come to office hours.
Otherwise you can raise a question on Slack.
Python Tutorial (first 5 pages)
quicksort, BST, quickselect
brief discussions of HW1|
tail recursion; non-recursive qselect
divide-n-conquer: quicksort vs. mergesort
merging two sorted lists via two-pointers
stable sort; motivations: sorting with multiple keys
stable: mergesort, insertion sort, non-randomized quicksort
not stable: randomized quicksort, selection sort (but can be made stable)
insertion/selection sort are "slow": O(n^2)
insertion sort with binary search: n x (O(logn) + O(n)) = O(n^2) still
divide-n-conquer: number of inversions
(msort, inv, longest)
|Thu: Quiz 1|
hand out graded quiz1|
insertion sort can be made O(nlogn) by balanced BST
discussions of HW2:
qsort with randomized pivot made stable by 3-way partition
generic way to stablize sort: decorate-sort-undecorate
mergesort implementation: mergesorted(a[1:], b) is O(n^2)
k numbers closest to input query, sorted
(Thu) k numbers closest to input query, unsorted;
x+y=z: O(n^3)->O(n^2 logn) -> O(n^2)
x+y=z: hashing (python set): O(n^2)
Priority Queue (emergency room)
slow implementations: sorted list, reversely sorted list, sorted linkedlist
fast implementation: binary heap; bubble-up/bubble-down
(k-closest, two pointers)
brief discussions of HW3|
heapify is O(n)
Python heapq tutorial
heapq bubble-down follows Knuth (vol.3) and different from textbooks
(Thu) data stream
quiz2 and discussions
(priority queues; baby Dijkstra)
|Thu: Quiz 2|
To prepare for coding interviews, you have to practice on some of the above (say, solving at least 20 problems on codeforces, with at least two from each topic). To prepare for ACM/ICPC, you have to practice a lot (solving at least 100 problems on zoj/poj).