keep storing the elements in hash.. now keep adding the elements of array is the sum is -ve calculate -(-sum) ans search in hash. lllrly do it for +ve... O(n) in space and O(n) time i guess
On Sat, Nov 6, 2010 at 7:21 PM, MAC <macatad...@gmail.com> wrote: > an array contain +ve and -ve element, find subarray whose sum is 0 > > -- > thanks > --mac > > -- > 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<algogeeks%2bunsubscr...@googlegroups.com> > . > For more options, visit this group at > http://groups.google.com/group/algogeeks?hl=en. > -- yezhu malai vaasa venkataramana Govinda Govinda -- 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.