1. Define the problem Closest-Pair as follows. • Input: an array A consisting of distinct numbers. • Output: the numbers x, y in A such that |x − y| is as small as possible. Design an O(n log n) time algorithm for this problem
. Define the List-Delete problem as follows. • Input: A linked list L of distinct integers and an element a of L. • Output: L with the element a deleted. Design an O(1)-time algorithm for the List-Delete problem.
Get Answers For Free
Most questions answered within 1 hours.