New Sorting Algorithm

I study in class 12, India. I have developed a new sorting algorithm. I dont have much knowledge about the names of sorting technique, ignore if you know this technique.

Let the array is a[].

int minIndex,maxIndex;
void sort(int a[])
{
    int l = 0,r = a.length-1,t = 0;
    while(l < r) {
        searchMinMax(a,l,r);     
        t = a[l];               
        a[l] = a[minIndex];
        a[minIndex] = t;
        t = a[r];
        a[r] = a[maxIndex];
        a[maxIndex] = t;
        l++;
        r--;
    }
}
void searchMinMax(int a[],int l,int r)
{
    int max=Integer.MIN_VALUE,min=Integer.MAX_VALUE;
    while(l < r)
    {
        if(a[l] < a[r])
        {
            if(a[r] > max)
            {
                max = a[r];
                maxIndex = r;
            }
            if(a[l] < min)
            {
                min = a[l];
                minIndex = l;
            }
        }
        else
        {
            if(a[l] > max)
            {
                max = a[l];
                maxIndex = l;
            }
            if(a[r] < min)
            {
                min = a[r];
                minIndex = r;
            }
        }
        l++;
        r--;
    }
}

It is working very fast and efficiently.
All comments are welcomed.


It consumes 17698 nanosecs for a 9 indexed array. Bubble sort consumes 76659 nanosecs

I’ll just say this: compare your algorithm against a really, really good already made sorting algorithm, like C++ std::sort which uses quicksort and then see the huge difference for your algorithm

//