Skip to content

Commit ffe3104

Browse files
committed
updated the semisort1
Updated the semisort1 program for mid number ambiguity.
1 parent c8e589d commit ffe3104

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

Sorting/semisort1.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,11 @@ static void sort(int [] ar,int ln,String styl) //A method to sort array accordin
1111
{
1212
int x;
1313
int [] tmparr =ar.clone(); //A method to clone an array
14+
if(ln%2==0)
15+
{x=(ln/2)-1; }
16+
else
17+
{x=(ln/2);}
1418

15-
x=(ln/2);
1619
Arrays.sort(ar,0,(x+1)); //A method to sort array in ascending order from specified start index(inclusive)
1720
Arrays.sort(tmparr,(x+1),(ln)); // to end index(exclusive) .
1821
if(styl.equals("AD"))

0 commit comments

Comments
 (0)