CS 491 CAP
Intro to Competitive Algorithmic
Programming
Jingbo Shang
University of Illinois at Urbana-Champaign
August 26, 2016
Welcome to CS 491 CAP!
Introduction
How to Practice
Assignments
Grading Policy
Examples
Practice Resources
CS 491 CAP Intro to
Intro To Segment Trees
Victor Gao
OUTLINE
Convention About Intervals
Range Query & Modification
Segment Tree - Real Life Analogy
Building a Segment Tree
Basic Operations
Lazy Propagation
Complexity Analysis
Implementation Tricks
CONVENTION ABOUT INTERVALS
Balanced Binary Search Trees
Victor Gao
OUTLINE
Binary Heap Revisited
BST Revisited
Balanced Binary Search Trees
Rotation
Treap
Splay Tree
BINARY HEAP: REVIEW
A binary heap is a complete binary tree such that
The key of a child is always less than or equa
CS 491 CAP
Intro to Competitive Algorithmic
Programming
Uttam Thakore
University of Illinois at Urbana-Champaign
August 26, 2015
Welcome to CS 491 CAP!
Introduction
How to Practice
Assignments
Grading Policy
Examples
Practice Resources
CS 491 CAP Intro to
CS 491 CAP
Intro to Competitive Algorithmic Programming
Lecture 2
Data Structures & Libraries
Uttam Thakore
University of Illinois at Urbana-Champaign
September 4, 2015
Updates
ICPC tryouts start next Saturday, Sept. 12th!
Sign-up information will be ma
CS 491 CAP
Ad Hoc and Simulation
Jingbo Shang
University of Illinois at Urbana-Champaign
Sep 11, 2015
What are Ad Hoc and Simulation?
Simulation: Do exactly what the problem statement tells
you.
E.g. simulate a board game, such as UNO, Blockus, and King
CS 491 CAP
Introduction to Graphs and Search
Jingbo Shang
University of Illinois at Urbana-Champaign
Sep 18, 2015
Outline
Graph Representation
BFS/DFS
Topological Sort (TopoSort)
CS 491 CAP Intro to Competitive Algorithmic Programming
2
Graph Represent
CS 491 CAP
Intro to Competitive Algorithmic Programming
Lecture 7
Mathematics
Uttam Thakore and Mike Seo
University of Illinois at Urbana-Champaign
October 9, 2015
Updates
ICPC regionals teams will be announced today!
Team members should be present at n
CS 491 CAP
Basic Graph Algorithms 1
Joon Young (Mike) Seo
University of Illinois at Urbana-Champaign
Oct 2, 2015
Today
Minimum Spanning Tree
Kruskal
Disjoint Set Data Structure
Prim
Shortest Paths
Dijkstra
Floyd-Warshall
Bellman-Ford
2
Minimum Spanni
Lecture 8
Contest Strategy
Uttam Thakore and Jingbo Shang
University of Illinois at Urbana-Champaign
October 16, 2015
Outline
Competing with a single computer
Triaging a problem set
Solving & debugging on paper
Creating test cases
Reference materials
CS 4
AhoCorasick Automaton
Jingbo Shang
University of Illinois, Urbana-Champaign
Feb 6, 2017
Outlines
String Matching Problem
KnuthMorrisPratt (KMP)
Trie
AhoCorasick (AC) Automaton
KMP is a special case
Outlines
String Matching Problem
KnuthMorrisPratt
Segment Tree II
Jingbo Shang
University of Illinois, Urbana-Champaign
Jan 30, 2017
Outlines
Warmup: Range Minimum Query
Complex Query
K-th Smallest Element Problem
Static Dynamic
Segment Tree + Other Data Structure
Persistent Segment Tree
Lowest Co
Problem A
Around the Track
Time limit: 2 seconds
In order to compare race tracks, we wish to compute their lengths. A racetrack is strictly
two-dimensional (no elevation). It is described by two simple polygons, where one is completely
contained inside th
CS 491 CAP
Introduction to Graphs and Search
Jingbo Shang
University of Illinois at Urbana-Champaign
Sep 9, 2016
Outline
Graphs
Adjacency Matrix vs. Adjacency List
Special Graphs
Depth-first and Breadth-first Search
Topological Sort
CS 491 CAP Intro to Co
CS 491 CAP
Intro to Competitive Algorithmic Programming
Lecture 2
Data Structures & Libraries
Victor Gao
University of Illinois at Urbana-Champaign
September 2, 2015
Updates
ICPC tryouts start Sunday, Sept. 18th!
Sign-up information will be mailed to th
A: Selling Numbers
Time Limit: 10 second(s)
Revolutionising telephony is expensive business. Thats why young entrepreneur Ace E. Emme is hoping
to sell some of his trademarked Global Unique phone numbers first, and then direct the resulting cash
at the te
CS 491 CAP
Intro to Competitive Algorithmic Programming
Lecture 6
Basic Graph Algorithms
Uttam Thakore
University of Illinois at Urbana-Champaign
September 30, 2015
Updates
ICPC Regionals teams will be announced by early next
week
If you have a team pre
A: Candy Store
You are walking with a friend, when you pass a candy store. You make a comment about
how unhealthy their wares are. Your friend issues an interesting challenge: who can be
the unhealthiest? Both of you will go into the store with the same a
CS 491 CAP
Intro to Dynamic Programming
Xin (Victor) Gao
University of Illinois at Urbana-Champaign
Sept 23, 2016
Today
What is DP?
3 example problems
Introductory example
Longest Common Subsequence
Coin Change
2
What is Dynamic Programming?
Algorit
CS 491 CAP
Ad Hoc and Simulation
Uttam Thakore
University of Illinois at Urbana-Champaign
Sep 16, 2016
Tryouts
Our first tryouts will be on Sunday, Sept 18
Registration closes tonight at 9 PM
See the mailing list archives for instructions
CS 491 CAP In
CS 491 CAP
Intro to Dynamic Programming
Joon Young (Mike) Seo
University of Illinois at Urbana-Champaign
Sept 25, 2015
Today
What is DP?
3 examples
Introductory example
Longest Common Subsequence
Coin Change
2
What is Dynamic Programming?
Algorithm desig