Problem with a binary insertion sort method

My task is to write a program to sort (a part of) a given list of comparable elements using binary insertion sort method. Binary insertion method is a modified insertion method that uses binary search to find the insertion point. Implementation has to be stable (has to preserve the original order of equal elements). There are three parameters to program:

a - the list;

left - starting index (included);

right - ending index (excluded).

The method signature is:

static public <T extends Object & Comparable<? super T>>

void biSort (List<T> a, int left, int right)

Piece of code

The method starts from line 130, there are tests and other sorting methods in this program. I dont know why my method doesnt do the job, so any help is more than welcome. Ive been workin on that method nearly week, but due to lack of skills in java it doesnt work out.

Best wishes,

Kert

Re: Problem with a binary insertion sort method

Quote:

I dont know why my method doesnt do the job, so any help is more than welcome. Ive been workin on that method nearly week, but due to lack of skills in java it doesnt work out.

What do you mean by the above? "Doesn't do the job," and "Doesn't work out" aren't specific enough. You might read this article to help you write posts that get helpful responses.

Re: Problem with a binary insertion sort method

Numbers list goes to wrong order, unsorted.

--- Update ---

Sorry i couldnt edit my post. I get java.lang.RuntTimeException. Heres the JUnit test which checks for errors Test program

Re: Problem with a binary insertion sort method

Have you ever successfully written a program that does sorting using insertion sort? I suggest you step back from the rather large program you've written and spend some time with just doing the sorting part using insertion sort and then binary insertion sort. You can find many helpful articles on the topic searching the Internet.

Re: Problem with a binary insertion sort method

I have, but the examples and guides are made with regular arrays of integers. But at my task, i have to use ArrayList and Comparable methods, i dont know why these methods get me confused.