Li Chun’s Count the number of inversions in a sequence

June 2, 2008

[Original post has malformed and or illegal xhtml constructs – mainly due to the unescaped ‘<‘ within the C++ code:
http://datamininginsight.blogspot.com/2007/01/count-number-of-inversions-in-sequencec.html]

An inversions in a sequence A1,A2,…,An of n different integers is defined as a pair of integers (Ai, Aj) satisfying Ai > Aj and i.

The idea is based on merge sort. When merge 2 sequences, A1, A2, …, Am and Am+1, Am+2, …, An, for each Ai>Aj (1<=i<=m and m+1<=j<=n), the counter of inversions add 1 to total value.

Begin Code:


int findInversion(vector* seq, int begin, int end, vector* newSeq) {
if(begin == end) {
(*newSeq)[0] = (*seq)[begin];
return 0;
}
int result = 0;
int middle = (begin+end)/2;
vector* left = new vector(middle - begin + 1);
vector* right= new vector(end - middle);
result = findInversion(seq,begin,middle,left) + findInversion(seq,middle+1,end,right);
//merge sequence left an sequence right
int iterLeft=0;
int iterRight=0;
int index=0;
while(iterLeftsize()){
if(iterRightsize() && (*left)[iterLeft]>(*right)[iterRight]){
(*newSeq)[index++] = (*right)[iterRight++];
result++;
}
else{
(*newSeq)[index++] = (*left)[iterLeft++];
}
}
while(iterRight <>size() ){
(*newSeq)[index++] = (*right)[iterRight++];
}
//release spaces and return
delete left,right;
return result;
}

End Code


Flickr Hot Link Test (rv2)

May 9, 2008

Hello

World


Raven Build 260 media store upload

April 12, 2008

Start:

JPEG:

BMP:

PNG:

Low res GIF:

Link to Zip File.

Link to PDF.

End.


Test from Build 238

March 28, 2008

Hello Raven!

Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Nam enim lectus, interdum sit amet, rutrum et, sagittis nec, orci. Integer bibendum tristique sapien. Aliquam sem sem, vulputate id, vehicula vel, vestibulum sed, magna. Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Sed non dui. Vivamus lorem diam, volutpat in, posuere id, sodales vel, tellus. Sed eget justo. Nunc dignissim neque id mauris. Etiam vitae tellus euismod ligula dapibus lacinia. Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Nullam commodo nulla at felis. Cras mi. Nam velit. Fusce gravida, tortor eu luctus aliquet, lectus nulla convallis lacus, in eleifend ipsum erat eu odio. Morbi condimentum. Aenean ornare. Sed eget magna.

Here is a link to a text document.

End.


IDNA Test

March 20, 2008

WTesting a IDNA Link (http://www.транспорт.com).

End.


Date Time Test 1

March 8, 2008

Current time approx 9.26PM EST.

Updated approx. 9.54PM EST


Test Post From 0.9.223

March 8, 2008

Hello World