Hi , Use Hashing for That , for sum =12 & arr[]={2,4,3,6,5,8,7}; store in to hashtable & for each index=0 in loop find sum-arr[index] so fro sum =12 if we do index=1 a[1]=4 & sum-a[1]=8 so stop it we have done..hope make d perfect code.
time Complxity o(n) space size of hashtable Let me me if anything wrong ?? Thanks & Regrads Shashank >>" The Best Way to Escape From The Problem is Solve It" -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.