Re: [algogeeks] number of inversion pairs

2010-09-18 Thread ashish kumar
On Saturday, September 18, 2010, jagadish jagadish1...@gmail.com wrote: Hi Raj, I think there is an nlogn solution to this problem which can be done by modifying merge sort.. the key lies in the merge routine, when the left array elements are greater than the right array, the right array

Re: [algogeeks] number of inversion pairs

2010-09-18 Thread ashish kumar
On Saturday, September 18, 2010, jagadish jagadish1...@gmail.com wrote: Hi Raj, I think there is an nlogn solution to this problem which can be done by modifying merge sort.. the key lies in the merge routine, when the left array elements are greater than the right array, the right array

[algogeeks] number of inversion pairs

2010-09-13 Thread Raj N
Given an array of n integers find all the inversion pairs in O(n) Inversion pair is one where a[i]a[j], ij -- 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

Re: [algogeeks] number of inversion pairs

2010-09-13 Thread Wladimir Tavares
My two cents If you were asked in O(n log n) you have to modified the merge sort algorithm for count the number of inversion! Wladimir Araujo Tavares http://www.si.ufc.br/~wladimir http://www.si.ufc.br/%7Ewladimir/ Fiz uma faculdade! Só não fiz a segunda porque acabaram os tijolos. On