1) sort each array O(n lg(n)) 2) for(i=0;i<strlen(array1);i++) for(j=0;j<strlen(array2);j++) { req= -(a[i]+b[j]); binsearch(c, req) //req element can be found out by using binary search in third array }
hence O(n*n*lg(n)) -- 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.