Pointers
Pointers
A variable contains a value,
but a pointer specifies where a value is located.
A pointer denotes the
memory location of a variable
Pointers
In C+, pointers are important for several reasons.
Pointers allow sharing of values stored in v
INTRO TO ALGORITHMS, COMP 160, Fall 2014, HOMEWORK 6
Deadline: Tuesday Oct. 21, 6pm. No late submissions. Solutions will be
posted on Tuesday evening.
Worth 1% of the nal grade.
1. Give an algorithm to nd all overlaps among a given set of intervals.
Pro
INTRO TO ALGORITHMS, COMP 160, Fall 2014, HOMEWORK 5
Deadline: Wednesday Oct. 15, before class
Worth 2% of the nal grade.
Justify your answers
1. Insert cfw_9, 8, 7, 5, 6, 3, 4 into an initially empty Red-Black tree, using
the order given. Draw the tre
INTRO TO ALGORITHMS, COMP 160, Fall 2014, HOMEWORK 4
Deadline: Wednesday Oct. 8, before class
See new late policy on homework page
Worth 2% of the nal grade.
1. Quicksort analyisis:
Suppose that a lucky pivot on n elements results in a partition into
s
INTRO TO ALGORITHMS, COMP 160, Fall 2014, HOMEWORK 3
Deadline: Wednesday Oct. 1, before class
Worth 2% of the nal grade.
1. We want to sort n integers in the range 0 to n2 as fast as possible. How
long does counting sort take? How fast can we get radix
INTRO TO ALGORITHMS, COMP 160, Fall 2014, HOMEWORK 2
Deadline: Wednesday Sept. 24, before class
Worth 2% of the nal grade.
Submit each question separately. Multiple sheets per question must be
stapled. Write your name on every sheet of paper.
1. We saw
INTRO TO ALGORITHMS, COMP 160, Fall 2014, HOMEWORK 1
Deadline: Wednesday Sept. 17, before class
Worth 2% of the nal grade.
Answer each question on a dierent sheet of paper.
Write your name on every sheet.
1. For each of the following, provide matching