Let S be a sorted array of n integers. Give an algorithm thatfinds the pair x, y
Fantastic news! We've Found the answer you've been seeking!
Question:
Let S be a sorted array of n integers. Give an algorithm thatfinds the pair x, y ? S that minimizes |x ? y|, for x = y. Youralgorithm must run in O(n) worst-case time.
Related Book For
Introduction to Algorithms
ISBN: 978-0262033848
3rd edition
Authors: Thomas H. Cormen, Charles E. Leiserson, Ronald L. Rivest
Posted Date: