Tuesday, November 1, 2011

Find Two Numbers in an Array that Sum to a Particular Value

//array of integer and a given value, a function to tell if the array contains 2 elements whose sum is equal to the value

bool is_sum_num( int num_arr[], int size, int sum)

quicksort(num_arr, size);
 //This part can be optimized in O(n).
 //Question for reader: how to do it? 
 for ( int i = 0; i

No comments: