Quiz 1
Total Time: 30 minutes Total Points: 15
Problem #1 (2 points)
Explain why the phrase at least O(n2) is meaningless.
A description of a function in terms of O-notation provides an upper bound on the growth rate
of the function. If an algorithm is O(
CS 180, Spring 2014 Homework 5
1. Were asked to help the captain of the UCLA tennis team to arrange a series of matches against USCs
team. Both teams have n players; the tennis rating (a positive number, where a higher number can
be interpreted to mean a
CS 180, Fall 2015 Homework 8
The following homework is due on Wednesday, December 2nd at the beginning of lecture.
When submitting your homework, please include your name at the top of each page. If you submit multiple
pages, please staple them together.
CS180 Introduction to Algorithms
University of California, Los Angeles
Assigned on June 27th, 2012
Due on July 6th, 2012
Homework #1
(Please refer to the homework policy section on the syllabus)
Problem #1 (Exercise 2.1 - 2)
Rewrite the Insertion-Sort alg
CS 180, Spring 2014 Homework 5 (Solution Outlines)
1. Were asked to help the captain of the UCLA tennis team to arrange a series of matches against USCs
team. Both teams have n players; the tennis rating (a positive number, where a higher number can
be in
CS 180: Algorithms and Complexity
University of California, Los Angeles
Summer 13
Homework # 2
Due Date: Wed. July 10th (In Class) LATE HOMEWORK WILL NOT BE ACCEPTED
Please write very clearly and succinctly (consider typing your homework),
Overly long hom
CS 180, Spring 2014 Homework 4 Solution Outlines
1. When their respective sport is not in season, UCLAs student-athletes are very involved in their community, helping people and spreading goodwill for the school. Unfortunately, NCAA1 regulations limit
eac
CS 180, Summer 2014 Homework 1 Solution Outlines
1. Suppose youre helping to organize a summer sports camp, and the following problem comes up. The
camp is supposed to have at least one counselor who is skilled at each of the n sports covered by the
camp.
NAME and UID:
!
CS180 Algorithms and Complexity
Winter 2015
D.S. Parker, Yuh-Jie Chen, Xiaoran Xu
Sample Final Examination
OPEN BOOK, OPEN NOTES
Tuesday, March 17, 11:001:50pm
1. Dynamic Programming #1
Grid Amusement Park looks like a 5x5 grid, with 40 ri
CS 180, Spring 2014 Homework 1 Solutions
0. Read and understand the homework submission and collaboration policy in the syllabus, as well as
the academic honesty policy. Despite being listed as item 0 on your rst homework, this is very
important! If you a
CS 180, Summer 2014 Homework 4 Solution Outlines
1. Suppose wed like to acquire a set of n useful programs. Each program is sold by two companies, and the
two versions are potentially of dierent quality. Suppose that company ones version of program i has
CS180 Winter 2011
Homework 3 The following homework is due Wednesday, January 26 at the beginning of lecture. When submitting your homework, please include your name at the top of each page. If you submit multiple pages, please staple them together. We al
CS 180: Algorithms and Complexity
University of California, Los Angeles
Summer 13
Homework # 1
Due Date: Wed. July 3rd (In Class) LATE HOMEWORK WILL NOT BE ACCEPTED
Please write very clearly and succinctly (consider typing your homework),
Overly long home
CS180 Winter 2011 Due: 2nd March
Homework 7
When submitting your homework, please include your name at the top of each page. If you submit multiple pages, please staple them together. We also ask that you do something to indicate which name is your last n
Sample Final Exam Questions
The cover page will have the same rules of the exam. The question pages will begin with some multiple
choice questions, similar to past exams. You will then have a short answer question; heres a sample one:
Short Answer
Give a
CS 180, Homework 1 Solutions
1. In class, we discussed the game of Nim. This game begins with a placement of n rows of matches on
a table. Each row i has mi matches. Players take turns selecting a row of matches and removing any
or all of the matches in t
CS 180, Fall 2015 Solution 7
The following homework is due on Wednesday, November 25th at the beginning of lecture.
When submitting your homework, please include your name at the top of each page. If you submit multiple
pages, please staple them together.
Assignment 5. Due June 1
CS180: Algorithms and Complexity
Spring 2015
Guidelines for submitting the solutions:
It is strongly recommended to use LATEX or other word processing software for submitting the
homework. This is not mandatory but will be helpfu
CS 180, Fall 2015 Homework 8
The following homework is due on Wednesday, December 2nd at the beginning of lecture.
When submitting your homework, please include your name at the top of each page. If you submit multiple
pages, please staple them together.
uynarmc Prograrmrung PracUce t'roblems
Dynamic Programming Practice Problems
Problems:
j
>.
1 of 1
Subsequence. Given a sequence of n real numbers A(1) . A(n), determine a contiguous
1. Maximum Value Conti !lUllLL<;
subsequence A(i) . AU) for which the su
CS180 Winter 2011
Homework 1 The following homework is due Wednesday, January 12 at the beginning of lecture. When submitting your homework, please include your name at the top of each page. If you submit multiple pages, please staple them together. We al
CS 180 Winter 2014
Homework 6
(2 pages)
The following homework is due Wednesday, February 19 at the beginning of lecture. You may
also turn in this assignment to the CS 180 drop box in 2432 Boelter Hall by 9:30 AM. Use of the
homework drop box is at your
CS 180 Winter 2014
Homework 9
(3 pages)
The following homework is due Wednesday, March 12 at the beginning of lecture. You may also
turn in this assignment to the CS 180 drop box in 2432 Boelter Hall by 9:30 AM. Use of the
homework drop box is at your own
Week Seven Discussion: Divide and Conquer
CS180 Spring 2014
1. Suppose you are given an array A with n entries, with each entry holding a distinct number.
You are told that the sequence of values A1 , A2 , . An is unimodal : for some index p between
1 and
Week 9 Discussion: NP-Completeness I
CS 180 Spring 2014
We will formalize the notion of what problems are hard for computers (and humans) to solve.
Intuitively, what constitutes a hard problem?
1. It is possible to solve.
2. When you see the answer, you a
Week 8 Discussion: Maximum Flow
CS 180 Spring 2014
The following is our algorithm for nding the maximum ow from s to t in a graph G. We
let fe denote the ow on edge e; ce is the capacity of edge e. We use e to denote the edge in the
opposite direction of
Week 10 Discussion: NP-Completeness II
CS 180 Spring 2014
Hints are given on the second page for some of the problems.
1. Consider the problem of Partial-TSP: We are given a set of n cities along with metric
distances between them. Were asked to determine
CS 180, Spring 2014 Homework 3
1. You are given a directed graph G with weights cfw_we on the edges and the shortest path distances (u)
from a designated source vertex s to every other vertex in G. However, you are not given the actual
paths. With this i
CS 180, Spring 2014 Homework 4
1. When their respective sport is not in season, UCLAs student-athletes are very involved in their community, helping people and spreading goodwill for the school. Unfortunately, NCAA1 regulations limit
each student-athlete
TENTATIVE SYLLABUS
CS180 Algorithms & Complexity, Winter 2015
Monday/Wednesday 46
Haines 220
D.S. Parker, Instr.; Yuh-Jie Chen, TA ; Xiaoran Xu, TA
1
Course Goals
This course is an introduction to the analysis and design of algorithms. It covers essenti
CS180 Midterm
Richard Sun
TOTAL POINTS
66 / 100
QUESTION 1
1 BFS
Shortest Path (10 / 25)
- 0 Correct
- 5 (a) right about the idea of splitting, but not correct
for the rest
- 20 (a) Blank
- 15 (a) Showed minor steps, but not a complete and
correct solutio
CS180: Algorithms and
Complexity
Professor: Raghu Meka ([email protected])
Plan for Today
Master theorem
Integer multiplication
Exponentiation
2
Asymptotic analysis
Methodology for comparing run-times
Given two functions f, g : N ! R+
f(n) = O(g(n): iff there is
CS180: Algorithms and
Complexity
Professor: Raghu Meka ([email protected])
Plan for Today
Logistics
What is an algorithm?
2
Course goals
Algorithmic thinking
Design and analysis
Algorithmic lens: all areas of science
Applications
Core design principles and