# Need help with binary insertion algorithm

• 09-29-2013, 04:45 PM
kert666
Need help with binary insertion algorithm
Hi first of all, im new to this forum and the main reason im here is my homework in "Algorithm and data structures".
Code is here

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. Your implementation has to be stable (has to preserve the original order of equal elements). There are three parameters to your 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) , it starts at the line 130 "bisort" method.
• 09-29-2013, 06:47 PM
kert666
Re: Need help with binary insertion algorithm
Quote:

Originally Posted by kert666
Hi first of all, im new to this forum and the main reason im here is my homework in "Algorithm and data structures".
Code is here

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. Your implementation has to be stable (has to preserve the original order of equal elements). There are three parameters to your 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) , it starts at the line 130 "bisort" method.

My problem is that i dont know how to create the insertion method for the binarysearch. If u take a look at my code theres my bugged solution for this task, perhaps someone could help me with it.
• 09-30-2013, 11:18 AM
Tolls
Re: Need help with binary insertion algorithm
Moving to New to Java from a staff only section.