100% found this document useful (1 vote)
204 views1 page

Comp 251 Assignment 4

This document outlines 4 problems related to data structures and algorithms for assignment #4. The problems cover: 1) inserting keys into a (2,4) tree and proving properties about its height, 2) designing an algorithm to construct a number not in a set in O(n) time, 3) designing an algorithm to construct a non-collinear point in O(n log n) time, and 4) designing an algorithm to find all maximal points in a set in O(n log n) time.

Uploaded by

dergachev
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PS, PDF, TXT or read online on Scribd
100% found this document useful (1 vote)
204 views1 page

Comp 251 Assignment 4

This document outlines 4 problems related to data structures and algorithms for assignment #4. The problems cover: 1) inserting keys into a (2,4) tree and proving properties about its height, 2) designing an algorithm to construct a number not in a set in O(n) time, 3) designing an algorithm to construct a non-collinear point in O(n log n) time, and 4) designing an algorithm to find all maximal points in a set in O(n log n) time.

Uploaded by

dergachev
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PS, PDF, TXT or read online on Scribd
You are on page 1/ 1

Data Structures and Algorithms COMP-251 A

Problem Assignment #4

1. Balanced Search Trees


Consider the following sequence of keys: (5, 16, 22, 45, 2, 10, 18, 30, 50, 12, 1).
(a) Consider the insertion of items with this set of keys (in the order given) into an initially-
empty (2,4) tree T. Draw T after each insertion.
(b) Show that a (2,4) tree can have a different structure when the order of the items inserted
is changed. Use the keys used in (a) in a different order of insertion.
(c) Prove that the height of a (2,4) tree storing n items is Θ(log n), i.e., prove that is it both
O(log n) and Ω(log n).

2. Element Uniqueness (Problem 6.21 in Udi Manber text)


The input is a set S of n real numbers. Design an O(n) worst-case time algorithm to con-
struct a number that is guaranteed not to be in S. Prove that Ω(n) is a lower bound on the
worst-case complexity of this problem under the comparison-based model of computation.

3. Non-collinearity of Points
The input is a set S of n points in the plane in general position, i.e., no three points lie on a
line. Invent an O(n log n) worst-case time algorithm to construct a new point X such that X
is not collinear with any pair of points in S. Prove the correctness of your algorithm. Prove
the complexity of your algorithm.

4. Maximal Points of a Set (Problem 8.18(a) in Udi Manber text)


The input is a set S of n points in the plane given by their x and y coordinates (real numbers).
A point p in the plane is said to dominate another point q if both the x and y coordinates
of p are greater than or equal to those of q. A point p is a maximal point of S if no other
point of S dominates it. Invent an O(n log n) worst-case time algorithm for finding all the
maximal points of a given set S. Prove the correctness of your algorithm. Prove the com-
plexity of your algorithm.

-1-

You might also like