try this...its will be less then O(n^2) 1. find the biggest and smallest element in smaller list
2. start traversing other list and compare every element with the biggest & smallest element of first list if element of second list is grater then the biggest element of first list then then move to next position in second list || element of second list is smaller then the smallest element of first list then move to next position in second list else traverse first list and print if element of second list exist in first list, if(exist) print and break this loop only ................ no sorting...and better performance.... On Jan 12, 2:27 pm, juver++ <avpostni...@gmail.com> wrote: > May be combining merge sort and calculating final result is a possible > solution. -- 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.