To solve this we use a hash table (stl perhaps) for i=1 to n: if (hash[m-a[i]] == 1)pair found; else set has[m-a[i]] = 1;
with this everytime we hit m-x and we have hit x till now we get a pair. On Oct 22, 4:32 pm, RIDER <mohit...@gmail.com> wrote: > you have an array of n integers, how would you find the integer pairs > which sum to m? complexity? > > if we use hash table then should we implement efficient hash table in c > ++? -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to this group, send email to algoge...@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.