Q3 - For example, given the array [3 4 4 6 8 9], kPairSum...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
Question 3. Pair Sums The class SortedIntegerArray contains a sorted representation of an array of integers. You are to implement a method kPairSum , that uses a recursive algorithm to determine whether the array contains two elements that sum to a given integer k, returning true if it does, false if it does not. The method should run in O(n) time , where n is the number of integers in the array.
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: For example, given the array [3 4 4 6 8 9], kPairSum (10) should return true, and kPairSum (16) should return false. Here is a test program testSortedIntegerArray , that provides random test cases. You should, however, test your program using a broader range of test cases. Pay particular attention to boundary conditions....
View Full Document

This note was uploaded on 10/28/2010 for the course CSE 2011 taught by Professor Someone during the Summer '10 term at York University.

Ask a homework question - tutors are online