skip to main | skip to sidebar

Machine Vision and a Programming Life

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
Posted by Unknown at 10:26 PM

No comments:

Post a Comment

Newer Post Older Post Home
Subscribe to: Post Comments (Atom)

Blog Archive

  • ►  2012 (3)
    • ►  July (1)
    • ►  June (2)
  • ▼  2011 (44)
    • ►  December (3)
    • ▼  November (17)
      • Pigs Get Fat, Hogs Get Slaughtered!
      • How to design a parking lot?
      • how to fit data into two probability density funct...
      • tic-tac-toe OOD design
      • How to post source code in blogspot
      • Correlation does not imply causation
      • smart_ptr vs weak_ptr
      • Suffix tree
      • Rectangle overlap
      • Linear programming: maximal sum of subsequence
      • Array rearranging algorithm
      • 贪吃蛇走法
      • Stack and Queue
      • What is a good OOD design answer?
      • Property of bitwise XOR
      • Find Two Numbers in an Array that Sum to a Particu...
      • How can we check whether a BT is a BST?
    • ►  October (11)
    • ►  September (4)
    • ►  June (6)
    • ►  April (1)
    • ►  March (1)
    • ►  February (1)
  • ►  2010 (38)
    • ►  November (7)
    • ►  October (18)
    • ►  September (13)
  • ►  2009 (2)
    • ►  September (2)

About Me

Unknown
View my complete profile