开发者

Identifying Clumps (Segments) of Data for Clump Sort Implementation

开发者 https://www.devze.com 2023-01-27 02:04 出处:网络
I am looking for Clump Sort implementation in any language or its pseudo code. The original research paper doesn\'t contain any. Since I am unable to find any existing solution (mostly because this te

I am looking for Clump Sort implementation in any language or its pseudo code. The original research paper doesn't contain any. Since I am unable to find any existing solution (mostly because this technique is quite new), I decided to implement it myself. So as the first step I need to identify the clumps of data in our numeric input. I understand that this might go towards Artificial Intelligence but I am ready for it as I know the basics anyway.

So any ideas about how to identify the clumps in data guys? For now I want to focus on clumps of numbers that are ascending or descending.

For example:

3, 7, 10, 56, 4, 1, 3, 34

has 3 clumps in asc order:

3, 7, 10, 56,

4,

1, 3, 34

My question is how to do this programmatically?

(Clump Sort: http://ieeexplore.ieee.org/xpl/freeabs_all.jsp?arnumber=5489222)

Thanks!


UPDATE:

Alright, after spending some time I've found a solution but I have no idea whether the same has been in the paper author's mind. If it was then we've probably added to the complexity of the heap sort instead of minimizing it.

int[] input = { 30, 7, 10, 56, 4, 1, 3, 34 };
List<ClumpStartEnd> clumps = new List<开发者_如何学Python;ClumpStartEnd>();
public void ClumpIdentifier(int start)
{
    for (int i = start + 1; i < input.Length + 1; i++)
    {
        if (i == input.Length || input[i] < input[i - 1])
        {
            clumps.Add(new ClumpStartEnd(start, i - 1));
            ClumpIdentifier(i);
            break;
        }
    }
}


I agree that Timsort would be the sort to beat, but I first discovered it shortly after the paper was submitted; sorry about that.

The OP's evaluation of the algorithm is a hair off. Each time Clump encounters an inversion, it alternates between expecting ascending and descending order. 3, 7, 10, 56, 4, 1, 3, 34 is thus an ascending run of 3, 7, 10, 56 then an inversion begins a descending run of 4, 1, then an inversion of that order begins an ascending run of 3, 34.

0

精彩评论

暂无评论...
验证码 换一张
取 消